more states, objects
This commit is contained in:
parent
2783c8c294
commit
5945139e48
23
src/game.js
23
src/game.js
@ -1,23 +1,22 @@
|
|||||||
window.onload = function() {
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, '');
|
||||||
var game = new Phaser.Game(
|
|
||||||
800,
|
|
||||||
800,
|
|
||||||
Phaser.AUTO,
|
|
||||||
'',
|
|
||||||
{ preload: preload, create: create });
|
|
||||||
|
|
||||||
function preload(){
|
game.state.add('play', {
|
||||||
|
preload: function(){
|
||||||
game.load.image('pink', 'assets/pink.png');
|
game.load.image('pink', 'assets/pink.png');
|
||||||
game.load.image('green', 'assets/green.png');
|
game.load.image('green', 'assets/green.png');
|
||||||
game.load.image('grey', 'assets/grey.png');
|
game.load.image('grey', 'assets/grey.png');
|
||||||
game.load.image('blue', 'assets/blue.png');
|
game.load.image('blue', 'assets/blue.png');
|
||||||
console.log("preload");
|
console.log("preload");
|
||||||
}
|
},
|
||||||
|
create: function(){
|
||||||
function create(){
|
|
||||||
var alienSprite = game.add.sprite(450, 290, 'pink');
|
var alienSprite = game.add.sprite(450, 290, 'pink');
|
||||||
console.log(alienSprite);
|
console.log(alienSprite);
|
||||||
alienSprite.anchor.setTo(0.5, 0.5);
|
alienSprite.anchor.setTo(0.5, 0.5);
|
||||||
|
},
|
||||||
|
render: function(){
|
||||||
|
game.debug.text('Adventure Awaits!', 250, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
});
|
||||||
|
|
||||||
|
game.state.start('play');
|
Loading…
Reference in New Issue
Block a user