2D Game Engine Development in HTML5

Textbook readings

Canvas Management - Code

Centralized access to rendering context, in this case Canvas (but could be SVG or just DOM)

CODE - Canvas Management

Canvas System Features

Asset Management - Code

General purpose asset loader

Want to be able to load any assets during the game, ie a loading screen, level transition, etc

Support for loading image files, audio files, json data files

Refer to asses by a resource name that is different than it's filename

CODE - Asset Management

Test Code for Asset management

Asset System Features

Sprites Module - Code

Primary visual objects, based on GameObject/Entity, used for displaying graphics

Data driven system, to enable future support for building more robust animations

Our Engine: Requires Underscore library

CODE - Sprite Module

Test Code for Sprite management

SpriteSheet class

Sprite Entity class

Sprites Engine Module

Scenes Module - Code

Responsible for keeping a list of objects and handle the adding or removing of them.

In charge of looping over that list for any given purpose (stepping, rendering)

Has a .step() and .draw(), so we can control updating and rendering entire groups of objects at a time.

Could be responsible for checking collision between objects.

Our Engine: Requires Underscore library


CODE - Scene Module

Test Code for Scene management

Scene Class

Stage Entity Class

Scene Engine Module