DebugUtils converted, re-name spaced the Input classes and started on Camera culling.

This commit is contained in:
Richard Davey
2013-08-31 21:50:34 +01:00
parent 70ee753859
commit 22847f6ade
17 changed files with 1736 additions and 359 deletions
+38 -3
View File
@@ -20,13 +20,48 @@
function create() {
game.add.sprite(0, 0, 'mushroom');
game.add.sprite(400, 0, 'mushroom');
game.add.sprite(800, 0, 'mushroom');
// Make our game world 2000x2000 pixels in size (the default is to match the game size)
game.world.setSize(2000, 2000);
for (var i = 0; i < 50; i++)
{
var s = game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom');
s.scrollFactor.setTo(0.5, 0.5);
}
for (var i = 0; i < 50; i++)
{
game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom');
}
for (var i = 0; i < 50; i++)
{
var s = game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom');
s.scrollFactor.setTo(2, 2);
}
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
{
game.camera.x -= 4;
}
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
{
game.camera.x += 4;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
{
game.camera.y -= 4;
}
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN))
{
game.camera.y += 4;
}
}
})();