Documentation

View the Propulsion documentation that describes the use and operation of the framework.

Demos

Play with and learn from games that use Propulsion.

Propulsion is a JavaScript game development framework for the HTML5 canvas element.


New in Propulsion 1.2

  • Math.vector functions have been added
  • Added Math.pointDistance2 which determines the square distance between two points
  • collision.masks has been renamed to collision.objects
  • collision.line has been renamed to collision.segment
  • The entire collision detection system has been overhauled. Collisions can now be automatically resolved using the minimum translation vector. The point of contact after collision resolution can also be used.
  • The double buffer has been removed to speed up drawing.
  • The init function now takes two more parameters: the width and height of the canvas as the user sees it. It is important that you update any calls to init, otherwise other things will break.
  • spriteObject.nextFrame now takes an optional increment parameter to be more useful for animation.
  • spriteObject.draw now uses the floored value of the passed subimage
  • spriteObject.draw now takes scaling factor parameters which can be used to mirror sprites.
  • Modifying the spriteObject.mask property before the load function is called no longer erases the custom mask.
  • draw.composite added. It can be used to change the drawing composition type.
  • Masks must be wrapped in a clockwise direction for collision resolution to function properly. See the mask specification in the documentation to see a description of mask wrapping and one of my beautiful pictures.

Some features of Propulsion include:

  • Support for any type of two dimensional game development.
  • Code patterns that are simple, yet robust and make sense for use with JavaScript.
  • A clear separation between different parts of the framework.
  • Support for collisions between any convex polygons with support for collison resolution.

Propulsion is licensed under the MIT License.


Brief Overview

Propulsion uses a loop to execute game logic. The number of times this loop is run per second is controlled by loop.rate. One iteration of the loop is called a tick.

During every tick, all registered objects have some of their methods invoked by Propulsion. These methods, of course, can come from the prototype chain. It is during these method invocations that game logic, drawing, etc. are executed.

Objects can be registered with the loop using the loop.register function. Objects can be removed from the loop using the loop.remove function. The object can be created by any means; there is no required pattern for object creation.


A method is just a function stored as a property of an object. When a method is invoked using a refinement (a dot expression . or bracket expression []) this is bound to that object.


© 2010 Caleb Helbling