Skip to content
hugeen edited this page Oct 19, 2012 · 15 revisions

How to add assets?

Adding them to the assets.js file

This file (/game/assets.js) is called automatically to feed the assets backbone collection

return [
    { type: "sprites", name: "wolf", size: 135, scenes: ["level"] },
    { type: "sprites", name: "pig", size: 115, scenes: ["level"] }
];

Adding them on the fly

// Add Image to the assets collection
assets.add({ type: "images", name: "background", scenes: ["level"] });
// Add Audio to the assets collection
assets.add({ type: "audio", name: "music", scenes: ["level"] });
// Add Sprite to the assets collection
assets.add({ type: "sprites", name: "wolf", size: 135, scenes: ["level"] });
Clone this wiki locally