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

CgEventsLib

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

Attention 請注意

This project is not released and still in actively development. Expect breaking changes before official release.

這個專案目前仍在測試階段,在正式推出之前,所有功能隨時都有可能大改,請謹慎試用。

Live Demo

Open Demo Events Sheet

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