/**** * Classes ****/ var Asteroid = Container.expand(function () { var self = Container.call(this); var asteroidGraphics = self.attachAsset('asteroid', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Asteroid movement logic goes here }; }); var Astronaut = Container.expand(function () { var self = Container.call(this); var astronautGraphics = self.attachAsset('astronaut', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Astronaut movement logic goes here }; }); var Stardust = Container.expand(function () { var self = Container.call(this); var stardustGraphics = self.attachAsset('stardust', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Stardust movement logic goes here }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var astronaut = game.addChild(new Astronaut()); var stardust = game.addChild(new Stardust()); var asteroid = game.addChild(new Asteroid()); game.update = function () { // Game logic goes here };
/****
* Classes
****/
var Asteroid = Container.expand(function () {
var self = Container.call(this);
var asteroidGraphics = self.attachAsset('asteroid', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Asteroid movement logic goes here
};
});
var Astronaut = Container.expand(function () {
var self = Container.call(this);
var astronautGraphics = self.attachAsset('astronaut', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Astronaut movement logic goes here
};
});
var Stardust = Container.expand(function () {
var self = Container.call(this);
var stardustGraphics = self.attachAsset('stardust', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Stardust movement logic goes here
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
var astronaut = game.addChild(new Astronaut());
var stardust = game.addChild(new Stardust());
var asteroid = game.addChild(new Asteroid());
game.update = function () {
// Game logic goes here
};