public class Shooting extends Rocket
{
private int life = 3;
public void act()
{
MyWorld ShootingsWorld = (MyWorld)this.getWorld();
//this moves the bullet upwards
setLocation(getX(), getY() - 5);
if(isTouching(Enemy.class)){
life--;
if(life==0){
ShootingsWorld.removeEnemy((Enemy)getOneIntersectingObject(Enemy.class));
life = 3;
}
}
}
}
my code looks like this. But for some reason it instantly removes the object on one touch?! and the life count decreases by a lot. Any solutions?

