|
3 anos atrás | |
---|---|---|
.. | ||
Behavior.js | 3 anos atrás | |
Collisions.js | 3 anos atrás | |
Game.js | 3 anos atrás | |
Input.js | 3 anos atrás | |
Inputs.js | 3 anos atrás | |
ReadMe.md | 3 anos atrás | |
Server.js | 3 anos atrás | |
Thing.js | 3 anos atrás | |
Things.js | 3 anos atrás |
Geoffrey is a compositional game behavior framework for Phaser.io v3+
Geoffrey helps you build complex games quickly using simple behavior based patterns.
Things
Behaviors
to Things
Geoffrey utilizes a dependency injection pattern where each game object starts out as an empty Thing
which can have Behaviors
attached to it. Think of it as a functional composition approach for defining game objects and behaviors instead of using object inheritance.
A Thing
is a Phaser.io Game entity such as sprite, text, or group. Geoffrey can create Things
that appear in your Game using Thing.create()
.
Thing.create
Creates a new Thing
which is registered in the Things
object. Returns a Phaser game object with an attached G
scope.
G
ScopeEach Thing
will have a property called G
. Anything related to our game logic ( and not directly to Phaser.js ) will be stored in the G
scope. This is super useful when creating or modifying game content. You can also modify G
values live while the game is playing directly through the console.
A Behavior
is a set of functions which are applied to a Thing
. Behaviors can export these properties:
Behavior.config
Used as default configuration scope for values used inside the Behavior
Behavior.create()
Called once when the Behavior is first applied to the Thing
.
Behavior.update()
Called every event loop of the Game.
Behavior.remove()
Called when the Behavior is detached.