/**** * Classes ****/ // Maze class var Maze = Container.expand(function () { var self = Container.call(this); var mazeGraphics = self.attachAsset('maze', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Maze logic goes here }; }); // The assets will be automatically loaded by the LK engine // Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Player movement logic goes here }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize player and maze var player = game.addChild(new Player()); var maze = game.addChild(new Maze()); // Position player and maze player.x = 1024; // Center of the screen player.y = 2732 - player.height; // Bottom of the screen maze.x = 1024; // Center of the screen maze.y = 1366; // Middle of the screen // Game update function game.update = function () { // Game logic goes here };
/****
* Classes
****/
// Maze class
var Maze = Container.expand(function () {
var self = Container.call(this);
var mazeGraphics = self.attachAsset('maze', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Maze logic goes here
};
});
// The assets will be automatically loaded by the LK engine
// Player class
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Player movement logic goes here
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 // Init game with black background
});
/****
* Game Code
****/
// Initialize player and maze
var player = game.addChild(new Player());
var maze = game.addChild(new Maze());
// Position player and maze
player.x = 1024; // Center of the screen
player.y = 2732 - player.height; // Bottom of the screen
maze.x = 1024; // Center of the screen
maze.y = 1366; // Middle of the screen
// Game update function
game.update = function () {
// Game logic goes here
};