MCPcopy
hub / github.com/KilledByAPixel/LittleJS / update

Method update

examples/shorts/platformer.js:9–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7 }
8
9 update()
10 {
11 // apply movement controls
12 const moveInput = keyDirection();
13 this.velocity.x += moveInput.x * (this.groundObject ? .1: .01);
14 if (this.groundObject && moveInput.y > 0)
15 this.velocity.y = .9; // jump
16
17 // move camera with player
18 cameraPos = vec2(this.pos.x, 9);
19 }
20}
21
22function gameInit()

Callers

nothing calls this directly

Calls 2

keyDirectionFunction · 0.85
vec2Function · 0.85

Tested by

no test coverage detected