This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

serpentity-contrib

0.1.1 • Public • Published

Serpentity Shared Objects

Pre-made systems, nodes and components using serpentity to ease development with serpentity by providing commonly needed objects.

Usage

  1. Install with npm
npm install serpentity-contrib
  1. Include in your project (assuming you're loading from the root, but this may vary in your project.)
<script src="/node_modules/serpentity-contrib/serpentity-contrib.js"></script>
  1. Include specific objects as you require them.
<script src="/node_modules/serpentity-contrib/components/position.js"></script>

What's Included?

Components

Components for Games

  • Bounds: Provides w and h to define an object that has bounds.
  • Collider: A simple box collider that has a type and 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 x and y to define an object that has a position.
  • Weight: Provides weight to define an object that has a weight.

Other Components

These components may be used for other types of demos.

  • Analyser: intended to include an audio analyser.
  • Configuration: a generic configuration holder.

Nodes

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

Other Nodes

  • Analyser: Analyser
  • Configurable: Configuration
  • ConfigurableAnalyser: Configuration + Analyser

Systems

Systems for Games

  • Acceleration: changes velocity based on acceleration
  • Gravity: changes y acceleration if object has weight
  • Motion: Changes position based on velocity. Has very simple bounds checking, and must be instantiated with a bounds object that has an x and y property.
Phaser Renderers

These renderers expect a game object, which is an instance of Phaser.Game, and a resolution object which contains w and h properties, in roder to properly render.

  • PhaserColliderRenderer: renders colliders.
  • PhaserPolygonRenderer: renders polygons, applying defaults where possible.

Other Systems

  • FrequencyLogger: An example on how to use the analyser node to obtain data.

Factories

Helper factories to generate some prefab entities.

  • AudioFactory: has a createMicAnalyser method that receives a serpentity engine and a callback that is called with the entity. This factory method initiates user media and creates an entity with an analyser node.

Readme

Keywords

none

Package Sidebar

Install

npm i serpentity-contrib

Weekly Downloads

3

Version

0.1.1

License

none

Last publish

Collaborators

  • benbeltran
  • rbdr