The start of World, also moved Game/Stage into core.

This commit is contained in:
Richard Davey
2013-08-29 21:57:36 +01:00
parent 6bf7bab917
commit 5b036557c0
5 changed files with 141 additions and 38 deletions
+9 -19
View File
@@ -12,37 +12,27 @@
(function () {
// var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update });
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }, false, true);
var bunny;
function preload() {
console.log('***> preload called');
game.load.image('cockpit', 'assets/pics/cockpit.png');
game.load.image('overdose', 'assets/pics/lance-overdose-loader_eye.png');
game.load.image('bunny', 'assets/sprites/bunny.png');
}
function create() {
console.log('***> create called');
// Create a basetexture
var base = new PIXI.BaseTexture(game.cache.getImage('overdose'));
var base = new PIXI.BaseTexture(game.cache.getImage('bunny'));
var texture = new PIXI.Texture(base);
bunny = new PIXI.Sprite(texture);
// center the sprites anchor point
bunny.anchor.x = 0.5;
bunny.anchor.y = 0.5;
// move the sprite t the center of the screen
bunny.position.x = 200;
bunny.position.y = 150;
bunny.position.x = game.world.centerX;
bunny.position.y = game.world.centerY;
game.stage._s.addChild(bunny);
game.world.add(bunny);
}
@@ -50,9 +40,9 @@
if (game.paused == false)
{
bunny.rotation += 0.1;
bunny.scale.x += 0.01;
bunny.scale.y += 0.01;
bunny.rotation += 0.01;
// bunny.scale.x += 0.01;
// bunny.scale.y += 0.01;
}
}