Skip to content

client.controllers.Direction.Direction

Mahatma Kollu edited this page Oct 19, 2021 · 2 revisions

Class: Direction

client/controllers/Direction.Direction

Manages the sending of what direction the player is facing (either "UP" or "DOWN") to the server thorugh the Direction event.

example

WRITTEN: player rotates their camera up, fast enough to trigger the "if (this.prevX !== x && math.abs(this.prevX - x) >= 0.02)" to evaluate to true which sets the direction to "UP" and fires the direction event with the direction.

Implements

  • OnInit

Table of contents

Properties

Methods

Properties

Direction

Private Direction: "DOWN" | "UP" = "DOWN"

stores the direction the player's camera is facing in

Defined in

src/client/controllers/Direction.ts:22


prevX

Private prevX: number = 0

stores the amount of heartbeats the camera has moved in a direction

Defined in

src/client/controllers/Direction.ts:24

Methods

onInit

onInit(): void

Returns

void

Implementation of

OnInit.onInit

Defined in

src/client/controllers/Direction.ts:26

Clone this wiki locally