- Hello Explorer
- Walls
- Walls 2
- The Maze
-
Enemies - 16 Enemies
- Archers!
-
Seek out the Enemy - Attack and Retreat
Explorer API
Explorer methods
Explorer can do one action per turn.
Note: walk
, getSpace
, look
and poke
can each take in a direction parameter:
- Direction.RIGHT
- Direction.LEFT
- Direction.DOWN
- Direction.UP
If no Direction is passed in, they will default to Direction.RIGHT.
Mutators / ActionsExplorer can do one action per turn.
walk()
- Moves the explorer forward (to the right) one Space.poke()
- Pokes the next space, causing damage to any Enemy there.recharge()
- Adds 9 to health.
Accessors:
look()
- Returns an Array of 3 Spaces in the designated Direction.getSpace()
- Returns the next Space on the board.getHealth()
- returns the value ofhealth
.
Space methods
isEnemy()
- returns true if the Space contains an Enemy, and false otherwise.isKnight()
- returns true if the Space contains a Knight, and false otherwise.isArcher()
- returns true if the Space contains an Archer, and false otherwise.isWall()
- returns true if the Space contains a Wall, and false otherwise.
Walls
Premium Content - Free Preview
Sometimes you need to take two steps back in order to move forward
You need to navigate towards the goal, and get around the Walls in your path. You can use explorer.getSpace().isWall()
to see if the Space to the right is a Wall. You can also pass a Direction parameter to getSpace
to check another Direction, such as:
explorer.getSpace(Direction.DOWN).isWall()
End of Free Content Preview. Please Sign in or Sign up to buy premium content.
Comments
Andreas
Jun 24, 12:08 PMI'm getting a NullPointerException in Game.gameWon. (link: http://pastebin.com/rC8NxL18).
Here's my code: (link: http://pastebin.com/tHbSaXW6).
What to do?
Learneroo
Jun 24, 1:58 PM@Andreas, sorry, that was caused by an error when Explorer attempts to make 2 moves in 1 turn. Remove your double move attempt and you'll be fine.
Learneroo
Jun 24, 3:17 PMThe issue has been fixed. Note you can also link to specific submissions of your available in the link Submissions (above code editor).