I want my "bob" actor to follow my "player" actor if you are in range of 75 pixels. How would I do that?
if (!getObjectsInRange(75, Player.class).isEmpty()) { Actor player = getObjectsInRange(75, Player.class).get(0); turnTowards(player.getX(), player.getY()); move(3); // however fast you want it to move setRotation(0); // optional (if you want your actor to stay up-right }
if (!getObjectsInRange(75, Player.class).isEmpty()) { Actor player = getObjectsInRange(75, Player.class).get(0); turnTowards(player.getX(), player.getY()); move(3); // however fast you want it to move setRotation(0); // optional (if you want your actor to stay up-right }
if (!getObjectsInRange(75, Player.class).isEmpty()) { Actor player = getObjectsInRange(75, Player.class).get(0); turnTowards(player.getX(), player.getY()); move(3); // however fast you want it to move setRotation(0); // optional (if you want your actor to stay up-right }