A HTML5 canvas game.
JavaScript Other
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo/deadsurvival
dev
server
src
static
test
.gitignore
Framework-Doc.md
README.md
TODO
config.json

README.md

#HTML5 Canvas Game Working on this canvas game when I get the time. It's built completely from the ground up and made to be completely modular so feel free to browse through the code and use classes or functions! Just as a heads up, naming isn't my strong point so prepared to be slightly confused if your strict on conventions. All critique welcomed!

##Objects All objects that may be rendered in a scene must have a update and render function even if the object doesn't have to be updated.

##Class Documentation Any classes I feel that a particulary cool or reusable wil be documented here.

##Loader.class.js Asset loader. Events could do with better names I think. All assets are stored in Loader.items

###Events started -- Loader has initiated loading assets. No params

progress -- Loader has made progress. Parameters are progress (int), name (string), item (object)

loaded -- All assets have been loaded.

###Methods Loader.getProgress -- Returns the current progress (int)

Loader.getAsset( name[string] ) -- Returns asset with given name (All assets are stored in Loader.items)

Loader.loadAsset( type["json", "image"], name[string], url[string] ) -- Loads asset. Supports json and image so far (but easily extendable). Returns nothing.

###Variables Loader.currentlyProcessed -- The number of items currently processed. (int)

Loader.totalItems -- The total number of items to be loaded (int)

Loader.items -- The item store (object)

##Animation.class.js Animation object that runs through an animation.

###Methods Animation( update[function], render[function], count[int], repeat[bool] ) -- Constructor.

Animation.update( frame[int] ) -- Update the animation using the frame.

Animation.render() -- Render the animation using the render function supplied.

##Shape.class.js For drawing shapes. Pretty nifty.

###Methods Shape( type["square", "rectangle", "circle", path], options) -- Constructor.

ShapeProperties requiredProperties Optional
circlex, y, radiusfillStyle, strokeStyle
squarex, y, sidefillStyle, strokeStyle
rect or rectanglex, y, width, heightfillStyle, strokeStyle
path*x, ywidth, height, fillStyle, strokeStyle

*Path -- Paths are a simplified version of vector paths. Currently only supports move (m) and (l) in the form of "<m|l>,". Paths are automatically closed.

Shape.render() -- Render the shape Shape.update( obj[Object] ) | ( prop[string], val ) -- Update a property of the shape. If using an object, it will update corresponding keys with their values. Values are also accessible via the dot operator on the shape instance. e.g. new Shape().value

###Example

var rect = new Shape("rect", {
	x: 50,
	y: 50,
	width: 300,
	height: 90
});

//draw a square
var p = new Shape("m0,0 l50,0 l50,50 l0,50", {
	x: 50,
	y: 50
});