public void act()
{
if (Greenfoot.isKeyDown("left"))
{
setRotation (getRotation() - 5);
}
if (Greenfoot.isKeyDown("right"))
{
setRotation (getRotation() + 5);
}
if ("space".equals(Greenfoot.getKey()))
{
fire();
}
}
private void fire()
{
CatAmmo catammo = new CatAmmo();
getWorld().addObject(catammo, getX(), getY());
catammo.setRotation(getRotation());
catammo.move(40.0);
}
}
The Ammo is already working and shooting perfectly i just want it to detect the dog when it hits him