User Manual: About The Trigger System

From Color Infection Wiki

Jump to: navigation, search

The trigger system is an important feature of Phyard Builder.

The trigger system allows you to create some event handlers to handle all sorts of events.

Below are when all sorts of events are handled.

When initializing a level:

  1. Create game world and entities (physics world has not been built yet).
  2. Trigger OnBeforeLevelInitializing event handlers.
  3. Build physics world and create entity physics proxies. and trigger OnTwoShapesBeginContacting event handlers.
  4. Initialize all entities and trigger OnEntityInitialized event handlers.
  5. Trigger OnAfterLevelInitialized event handlers.

When updating a level (advance one step):

  1. Trigger OnWorldMouse, OnShapeMouse, OnKeyDown and OnKeyUp event handlers.
  2. Trigger OnBeforeLevelUpdating event handlers.
  3. Update physics world and trigger OnTwoShapesBeginContacting, OnTwoShapesEndContacting and OnTwoShapesKeepContacting event handlers.
  4. Update all entities and trigger OnEntityUpdated event handlers.
  5. Trigger OnKeyHold event handlers.
  6. Trigger OnWorldTimer, OnEntityTimer and OnEntityPairTimer event handlers.
  7. Trigger OnAfterLevelUpdated event handlers.

When an entity is destroyed, trigger OnEntityDestroyed event handlers.