Home

Awesome

backbone-game-engine

An elemntary HTML5 Game Engine using Backbone. Demonstration with Super Mario is here:

Why Backbone?

Backbone implements Events, Models and Collections. Models and Collections have an extend function to easily do inheritance. Game engines implement OO and events in their own way. Backbone is now widely used and provides these features in a standard fashion. I hope this project can make game programming accessible to non-game programmers out there that already use Backbone.

Phylosophy

A Sprite is a Model. Use the getter and setter to define is attributes. Other objects can listen to changes on those attribues.

Backbone.Engine is a collection of ordered Models (typically Backbone.Sprite). Uses HTML5's requestAnimationFrame to provide a 60 frames per second game loop. Every frame, the engine performs these things:

The update function is used to update the Model position, animation, detect collisions, or whatever you like. If it requests a redraw, the engine will then call its draw function. The Engine ensures that Models are updated and drawn in the order they are sorted in the Collection. Consult Backbone docs to find out how to change the sort order.

Classes