new Maze_Player()
Player class for the 3D mazes. At each movement synchronises $gamePlayer.
Methods
goto(x, y, direction)
Teleports the player.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
X coordinate of the destination. |
|
y |
Y coordinate of the destination. |
|
direction |
Direction (2-4-6-8) to be faced. |
initialize(cameraDistance, cameraWidth, speed, rotationSpeed)
Constructor. Initializes the player parameters and the raycaster's camera.
Parameters:
| Name | Type | Description |
|---|---|---|
cameraDistance |
Camera distance from the player. |
|
cameraWidth |
Camera plane width. |
|
speed |
Player's speed. |
|
rotationSpeed |
Player's rotation speed. |
moveBackward()
Makes the player step backward.
moveForward()
Makes the player step forward.
rotateLeft()
Rotates the player counterclockwise.
rotateRight()
Rotates the player clockwise.
strafeLeft()
Makes the player step sideways to the left.
strafeRight()
Makes the player step sideways to the right.
update()
Synchronises $gamePlayer with the maze player.