im trying to make a code where the player can eat humans, and once it does, it gets a tail of those humans (just like in snake where if the player eats an apple, the snake gets a longer tail). i dont know how to determine the position of the tail so that it follows the player. urgent!! i need help please!!
public class PlayerZombie extends BaseClass { private int humanCounter = 1; public void eatHuman() { if (canSee(Human.class)) { removeObject(Human.class); Level level = (Level) getWorld(); level.addScore(); humanCounter++; getWorld().addObject(new Tail(humanCounter),getX(),getY()); } }
public class Tail extends Actor { public int count = 0; public int life; public Tail(int l) { setImage("playerfront.png"); life = 1; } public void act() { if(count == life) { getWorld().removeObject(this); } count++; } }