Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void teleport(Room room)
- {
- Random rand = new Random();
- setX(rand.nextInt(18) + 1); // Radnom X Cordinate + 1 to make sure robby dosent go edge of box
- setY(rand.nextInt(18) + 1); // Random Y Cordinate + 1 to make sure robby dosent go edge of box
- if (!obstacle_ahead(room)) // If no obstcle ahead robby moves
- {
- move();
- }
- else
- {
- while (obstacle_ahead(room))
- {
- setX(rand.nextInt(18) + 1);
- setY(rand.nextInt(18) + 1);
- move();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement