Skip to content

[game] User Guide

Gokul Rajiv edited this page Jul 25, 2021 · 5 revisions

Game Module

Documentation

You can check out the module's documentation for more information on each exposed function's specifications.

Game Lifecycle Functions

The Source Academy game module, is a wrapper of Phaser 3 API, which the Source Academy game uses.

It is first important to undertand the 3 functions preload(), create(), and update() that Phaser used for defining behaviour at different stages of a game scene's lifecycle:

  • Preload: Used to load game assets before run before Create
  • Create: Used to create your game objects after the game scene starts
  • Update: Used to update game object states, and called once every game step while the scene is running

You will be defining the same 3 functions for defining your room behaviour.

Writing your own room code

To customize your room with your own room code, first find and navigate to the mission associated with that room. You can open the room in-game on a separate tab. As you write your room code, you can run the code in the editor as a sanity check for basic syntax errors. Game module functions that are executed within the editor, will not return or do anything. As a result, the error messages you might see if you run them outside of the lifecycle functions, can be misleading. As a final check, hit refresh in your game room to load and run your latest mission code.

Examples

Example 1: Yoyo

Coming Soon

Example 2: Fireworks Clicker

Coming Soon

Clone this wiki locally