This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Test" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pandaConfig = { | |
system: { | |
startScene: 'Game' | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Change scene to Game | |
game.system.setScene('Game'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create new scene named Main | |
game.createScene('Main', { | |
init: function() { | |
// Scene initiated | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example 1 | |
pandaConfig = { | |
system: { | |
// HiRes mode with support for @2x textures | |
hires: 2 | |
} | |
}; | |
// Example 2 | |
pandaConfig = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create new pool | |
game.pool.create('MyPool'); | |
var myObject = {}; | |
// Put object to pool | |
game.pool.put('MyPool', myObject); | |
// Get object from pool | |
var myObject2 = game.pool.get('MyPool'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
game.createScene('Main', { | |
keydown: function(key) { | |
if (key === 'SPACE') { | |
// Space key down | |
} | |
}, | |
keyup: function(key) { | |
if (key === 'SPACE') { | |
// Space key up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.camera = new game.Camera(); | |
this.camera.addTo(this.levelContainer); | |
this.camera.acceleration = 1.5; | |
this.camera.minX = this.camera.minY = 0; | |
this.camera.maxX = Math.max(0, this.level.width - game.system.width); | |
this.camera.maxY = Math.max(0, this.level.height - game.system.height); | |
this.camera.offset.x = game.system.width / 2 - 400; | |
this.camera.setPosition(this.player.sprite.position.x, this.player.sprite.position.y); | |
this.camera.follow(this.player.sprite); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define volume in config | |
pandaConfig = { | |
audio: { | |
soundVolume: 1.0, | |
musicVolume: 0.5 | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Play music | |
game.audio.playMusic('music1'); | |
// Change music | |
game.audio.playMusic('music2'); | |
// Stop music | |
game.audio.stopMusic(); |