JSWarrior by FusionCharts

Level 1

You wake up in a strange corridor. There's a sign at the end of the hallway. Walk over to it.

JSWarrior is a turn based game. You make one action (moving, attacking, etc) each turn by making decisions with code you write in the jsWarrior.turn function.

Call warrior.walk() to walk forward in the jsWarrior.turn function.

Note: The code required to complete this level is already filled up, to give you an idea of how to use it. Just Click Run to see it in action!

Turns

The game is played in turns. At every turn, the jsWarrior.turn is executed to determine what action the warrior will take. It's your responsibility to define the behavior using this function.

Actions

An action is something that the warrior can do. You can perform one action per turn

FunctionDescription

warrior.walk()

Walks in the direction the warrior is currently facing. Use warrior.walk('backward') to walk backward.

warrior.attack()

Attack one step in the direction that you're facing. An attack deals 5 points of damage.

warrior.rest()

Rest for the turn and gain 2 points of health.

warrior.pivot()

Turn around and face the other direction.

warrior.collect()

Collect a diamond if it's there one step in the direction that you're facing.

Checking your surroundings

You can check to see what lies in your immediate surroundings. Simply call warrior.check() to see what's in the next step, in the direction you're facing, and warrior.check('backward') to see what's behind you. The function returns a string, and the possible values are:

StringDescription

empty

Nothing in the next cell

enemy

An enemy in the next cell

diamond

A gem that you can collect.

wall

A wall of the room

Enemies

NameDescription

Crab

A small animal with a meelee attack.

Troll

A much stronger enemy with a more powerful meelee attack

JavaLiner

A frustrated developer who hates jsWarrior. Throws JavaLins at you from a distance. Has a limited range.

Powered by Google App Engine