Hello. I'm sorry for my bad English. I need help. How can i realize hit?
My current code is....
public void Hit()
{
List <Zombie1> zombies = getObjects(Zombie1.class);
List <bullet> bullets = getObjects(bullet.class);
for (Zombie1 zombie : zombies)
{
for (bullet bullet : bullets)
{
if ((zombie.getY() == bullet.getY()) && (zombie.getX() == bullet.getX()))
{
Greenfoot.stop();
}
}
}
}
I check all objects' coordinates. if it's equal then bullet hit zombie. My code isnt work. How can i realize it?