CgEventsEngine master READ ONLY 0
  • explorer
  • search
a [App]
a CG.CgEventsEngine
a README.md
a app.ts
a [Test]
a test
  • README.md

CgEventsEngine

The engine of CgEvents. CgEvents is a great way to build your own games with with a CG.built-in editor.

Concept

The engine takes a *.events file to run.

The .events file is an encoded json which contains a config field and a events field.

{
    config: {
        stage: {
            width: "number",
            height: "number",
            resolutionPolicy: "showAll" | "exactFit" | "fixedWidth" | "fixedHeight" | "origin",
            alignHorizontal: "left" | "center" | "right",
            alignVertical: "top" | "middle" | "bottom"
        }
    },
    events: [
        {
            id: "string",
            triggers: [],
            checks: [],
            actions: []
        },
        ...
    ]
}

Yon can edit the json with CG.built-in editor to control all your game events.

How Events Work

Each event contains a TRIGGER, some CHECKS, and some ACTION. The event flow works like this: 1. The TRIGGER of the event is triggered by the engine (keyboard pressed, event over, or maybe the hero collides with an enemy) 1. Once the trigger is triggered, the engine then goes check the CHECKS. 1. If all CHECKS pass, the engine executes all the ACTIONS in the event.

Getting Started

let manager = new CgEventManager();
manager.importFromSource('CG.YourProject/yourGame.events')
    .then(() => manager.preload())
    .then(() => manager.start())
    ;

Versioning

We use SemVer for versioning.

Authors

READ ONLY
  • problem
  • console
No problems have been detected so far.
Ln 1, Col 1, Sel 0
Markdown