Global

Members

scene

Global variables
Source:

Methods

animate() → {None}

Animates the scene
Source:
Returns:
Type
None

createPlayer(scene) → {None}

Creates THREE.js player with THREE.js camera perspective and predetermined controls
Parameters:
Name Type Description
scene THREE The world instance of the game
Source:
Returns:
Type
None

createSpace(scene) → {None}

Creates THREE.js geometric floor, walls, and ceiling to create scene of playing area
Parameters:
Name Type Description
scene THREE The world instance of the game
Source:
Returns:
Type
None

getRandomLoc(min, max) → {number}

Randomizes location of target to click
Parameters:
Name Type Description
min int The int specifying the min -- lower bound.
max int The int specifying the max -- lower bound.
Source:
Returns:
Location of target
Type
number

getRandomSize(min, max) → {number}

Randomizes size of target to click
Parameters:
Name Type Description
min int The int specifying the min -- lower bound.
max int The int specifying the max -- lower bound.
Source:
Returns:
Size of target
Type
number

init() → {None}

Initializes the world, game, player, and targets
Source:
Returns:
Type
None

keyDown(event) → {None}

Detects when a key has been pressed down
Parameters:
Name Type Description
event event Keyboard event
Source:
Returns:
Type
None

keyUp(event) → {None}

Detects when a key has been pressed down
Parameters:
Name Type Description
event event Keyboard event
Source:
Returns:
Type
None

lockCursor(havePointerLock) → {None}

Checks browser to see if cursor can be locked, locks cursor if so otherwise present error message.
Parameters:
Name Type Description
havePointerLock boolean The boolean determining whether browser is capable of pointer lock.
Source:
Returns:
Type
None

onWindowResize() → {None}

Handles window resizing
Source:
Returns:
Type
None

render(scene) → {None}

Renders THREE.js WebGL scene
Parameters:
Name Type Description
scene THREE The world instance of the game
Source:
Returns:
Type
None

spawnTarget(scene) → {None}

Spawns THREE.js geometric target with position and size determined from getRandomLoc() and getRandomSize()
Parameters:
Name Type Description
scene THREE The world instance of the game
Source:
Returns:
Type
None