I have an actor, who can jump and i have another actor, who can shoot. The problem is that if i shoot in the air i want the bullet to hit the player1(P1) only on certain x and y coordinates. I tried to put the getX into the code and that worked. So now i can only hit him on these certain x coordinate but i want him to get hit on a certain x and y coordinate. How can i make him get hit also on a y coordinate?
public class BulletP12 extends Mover
{
public void act()
{
move(13.5);
lookForP2();
if(atWorldEdge())
{
getWorld().removeObject(this);
getImage().setTransparency(255);
}
}
public void lookForP2()
{
if (isTouching(P2.class)&& getX()>=1050 )
{
removeTouching(P2.class);
getImage().setTransparency(0);
}
}
}