I move my actor(Human) right 10 pixel but the gun does not follow the human. Please give me the code that make the gun follow the another actor. Thank you.
//in your human class:
private Gun gun;
public Human() {
gun = new Gun();
}
public void addedToWorld(World world) {
getWorld().addObject(gun, getX(), getY()); //maybe you have to use other coordinates here;
}
public void setLocation(int x, int y) {
super.setLocation(x, y);
gun.setLocation(x, y);//again maybe some other coordinates;
}