Global

Methods

(async) animate()

Animates the scene
Source:

calcSpeed(v0, y)

Calculates the speed depending on the y value of the planeLookAt vector and the previous speed
Parameters:
Name Type Description
v0 number previous speed
y * y value of the planeLookAt vector 1 = straight up, -1 = straight down
Source:

(async) createModelPlane()

Creates the plane model and adds it to the scene
Source:

gameOver()

Quits the game and shows a game over message
Source:

handleFlying()

Moves the Plane and the Camera
Source:

handlePlaneOutOfBounds()

Turns the plane around if to far away from the center This is to prevent the plane from flying away
Source:

handleScore()

Handles the collision detection between the plane and the torus objects If plane collides with a torus, the torus is removed from the scene and the score is updated
Source:

handleTime()

Decreases the time and checks if the time is up
Source:

(async) init()

Initializes the flight simulator game
Source:

initDevControls()

Initialize developer controls / keyboard shortcuts and experimental features
Source:

(async) initFlying()

Initializes the flying controls
Source:

(async) initOceanAndSky()

Initializes the ocean and sky !!! This code and the textures are directly from three.js !!!
Source:

initStats()

Initialize the FPS stats
Source:

invertControls()

Inverts the controls and saves the setting in the local storage
Source:

placeObstaclesObjects()

Places other objects which the plane can collide with Object types: - DodecahedronGeometry - IcosahedronGeometry - OctahedronGeometry - TetrahedronGeometry
Source:

placeTorusObjects()

Places torus objects in the scene at random positions
Source:

showInvertedControlsDiv()

Shows a alert with if the controls are inverted or not for 3 seconds
Source: