kevinputnam / js_basic_game

Implements a simple HTML5/Canvas RPG style game engine with a built-in editor with no other library dependencies
0 stars 0 forks source link

Add callbacks to scenes and things #6

Open kevinputnam opened 1 week ago

kevinputnam commented 1 week ago

Allow for multiple callbacks/triggers for adding actions. Rather than "run" method in actions, have multiple Callbacks like "on_collision".

kevinputnam commented 1 week ago

Examples: onClick, onCollision, onInteract, onInit

kevinputnam commented 2 days ago

Need to implement framework in game and game container classes to support callbacks. The test implementation of on_select_button is a complete hack and is not generalizable to other cases.

In addition, this highlights the need for a reusable script object at the game level that is a basically an action container. See Issue #9

kevinputnam commented 2 days ago

The callbacks exposed to the editor will be determined by the parent class.

kevinputnam commented 2 days ago

If game, scene, and thing set the same callback, the priority will be: thing, scene, game.