Class: Snake

Snake

new Snake(p_init, p_plane)

Parameters:
Name Type Description
p_init Object Should contain three initialization objects to initialize the snake: p_init.tail, p_init.length, and p_init.direction.
p_plane $app$.game.snake.Plane The plane where the snake is to be placed.
Source:

Members

<static, constant> EAST :Object

Type:
  • Object
Source:

<static, constant> LEFT :String

Type:
  • String
Source:

<static, constant> NORTH :Object

Type:
  • Object
Source:
Type:
  • String
Source:

<static, constant> SOUTH :Object

Type:
  • Object
Source:

<static, constant> WEST :Object

Type:
  • Object
Source:

length :int

The current length of the snake.
Type:
  • int
Source:

Methods

move() → {Boolean}

Moves the snake one field further. If it hits a food item, it grows. If it hits a wall or body item, it dies.
Source:
Returns:
true, if and only if the snake is dead.
Type
Boolean

reset()

Resets the snake.
Source:

turnLeft(p_direction)

Turns the snake 90° to the left or to the right.
Parameters:
Name Type Description
p_direction String Either Snake.LEFT or Snake.RIGHT.
Source:
W. Kowarschick © 2013 (CC BY-NC-SA 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/)
Documentation generated by JSDoc 3.3.0-dev on Sun Dec 15 2013 11:28:44 GMT+0100 (MEZ) using the DocStrap template.