i want an actor to face another one, so that he can move towards him just with the method
move(1);
i dont know how to adjust this...
I hope you can help me
public void act()
{
Ship ship= (Ship) getWorld().getObjects(Ship.class).get(0);
turnTowards(ship.getX(), ship.getY());
setRotation(getRotation() - 90);
move(2);
} public DartLaser()
{
try
{
Ship ship = (Ship) getWorld().getObjects(Ship.class).get(0);
turnTowards(ship.getX(), ship.getY());
}
catch(IndexOutOfBoundsException ex) {}
}
public void act()
{
X = getX();
Y = getY();
move(4);
if(getY() >= 649)
{
getWorld().removeObject(this);
}public DartLaser()
{
}
public void addedToWorld(World world)
{
if (!world.getObjects(Ship.class).isEmpty())
{
Ship ship = (Ship)world.getObjects(Ship.class).get(0);
turnTowards(ship.getX(), ship.getY());
}
}
public void act()
{
X = getX();
Y = getY();
move(4);
if(getY() >= 649)
{
getWorld().removeObject(this);
}