Serpentity Shared Objects
Pre-made systems, nodes and components using serpentity to ease development with serpentity by providing commonly needed objects.
- Install with npm
npm install serpentity-contrib
- Include in your project (assuming you're loading from the root, but this may vary in your project.)
- Include specific objects as you require them.
Components for Games
- Bounds: Provides
hto define an object that has bounds.
- Collider: A simple box collider that has a
typeand a box, used to handle collider geometry independent from the other properties.
- Motion: Provides properties for motion using acceleration and velocity.
- Polygons: An array of polygons that can be rendered for a simple polygon renderer.
- Position: Provides
yto define an object that has a position.
- Weight: Provides
weightto define an object that has a weight.
These components may be used for other types of demos.
- Analyser: intended to include an audio analyser.
- Configuration: a generic configuration holder.
Note: If you need variations on these nodes, you can create a new one by extending an object with the node you want to target.
Nodes for Games
- Collider: Position + Motion + Collider
- Gravity: Position + Motion + Weight
- Movement: Bounds + Position + Motion
- PolygonRender: Position + Bounds + Polygons
- Analyser: Analyser
- Configurable: Configuration
- ConfigurableAnalyser: Configuration + Analyser
Systems for Games
- Acceleration: changes velocity based on acceleration
- Gravity: changes
yacceleration if object has weight
- Motion: Changes position based on velocity. Has very simple bounds
checking, and must be instantiated with a
boundsobject that has an
These renderers expect a
game object, which is an instance of
Phaser.Game, and a
resolution object which contains
properties, in roder to properly render.
- PhaserColliderRenderer: renders colliders.
- PhaserPolygonRenderer: renders polygons, applying defaults where possible.
- FrequencyLogger: An example on how to use the analyser node to obtain data.
Helper factories to generate some prefab entities.
- AudioFactory: has a
createMicAnalysermethod that receives a serpentity
engineand a callback that is called with the entity. This factory method initiates user media and creates an entity with an analyser node.