I am working on creating a scenario with using an algorithm to determine the amount of step for the actor class to use to search for a "treasure".. My question is with the Istouching error. I have used several different versions of the istouching and none of them seem to be working.
I am looking for any help with getting the touching code working.
Thanks!
I am also attempting to make an algorithm that automatically adds one each loop, changes direction, and then adds one to the variable and then moves the variable over and over.
public void TouchingTreasure() { Actor player; player = getOneObjectAtOffset(0, 0, Player.class); if (player !=null) { System.out.println("Good Job!"); Greenfoot.stop(); } }
private int algorithm; public Player2() { algorithm = 1; } public void act() { move(); } public void move() { move(algorithm); setRotation(180); next(); } public void next() { algorithm = algorithm + 1; }