Events variable

An object containing all the events that can listened from scripting.

Signature:

Events: typeof ScriptEvents

Example

 
 import { Emitter, Events } from "@oo/scripting"
 
 // ...
 Emitter.on(Events.KEY_DOWN, handler)
 
 
 // ... later
 Emitter.off(Events.KEY_DOWN, handler)
 

Currently the following events are supported

  • KEY_DOWN - The event triggered when a key is pressed down.

  • KEY_UP - The event triggered when a key is released.

  • MOUSE_DOWN - The event triggered when a mouse button is pressed down.

  • MOUSE_MOVE - The event triggered when the mouse is moved.

  • MOUSE_UP - The event triggered when a mouse button is released.

  • TOUCH_MOVE - The event triggered when a touch point is moved.

  • TOUCH_START - The event triggered when a touch point is initially placed on the touch surface.

  • TOUCH_END - The event triggered when a touch point is removed from the touch surface.

  • WHEEL - The event triggered when the mouse wheel is scrolled.

  • GAME_SPACE_LOADED - The event triggered when the game space has finished loading all the components.

  • GAME_READY - The event triggered when the game is ready to start.

  • GAME_START - The event triggered when the game is started.

  • GAME_DISPOSE - The event triggered when the game is disposed.

  • GAME_END - The event triggered when the game ends.

  • GAME_PRE_UPDATE - The event triggered before the game update. This event happens before the physics update.

  • GAME_UPDATE - The event triggered during each frame of the game update loop.

  • GAME_NOTIFY_PAUSE - The event triggered when the game notifies a pause.

  • GAME_NOTIFY_RESUME - The event triggered when the game notifies a resume.