Hi,
I'm currently writing a program where a Lobster is chasing a Crab and I'm stuck currently getting the Crab rotate a random amount away from the Lobster. Here is the Part I've got some problems...
PS: Note that i'm not finished with the I've put in.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public void isatEdge() { if (isAtEdge()) { if (!getWorld().getObjects(Lobster. class ).isEmpty()) { Actor player = (Lobster)player.getX( 0 ); int playerX = player.getX(); int playerY = player.getY(); } } else { move(- 50 ); turn( 45 - Greenfoot.getRandomNumber( 90 )); } } |