Tweens are now bound to their own TweenManager, not always the global game one. So you can create your own managers now (for you clark :)

This commit is contained in:
photonstorm
2014-03-07 01:26:09 +00:00
parent 3b2573de9a
commit a51ae03246
8 changed files with 70 additions and 31 deletions
+17 -8
View File
@@ -1,7 +1,10 @@
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
function preload() {
var text;
var counter = 0;
function preload () {
// You can fill the preloader with as many assets as your game requires
@@ -10,24 +13,30 @@ function preload() {
// The second parameter is the URL of the image (relative)
game.load.image('einstein', 'assets/pics/ra_einstein.png');
}
function create() {
// This creates a simple sprite that is using our loaded image and
// displays it on-screen
// and assign it to a variable
var image = game.add.sprite(0, 0, 'einstein');
// displays it on-screen and assign it to a variable
var image = game.add.sprite(game.world.centerX, game.world.centerY, 'einstein');
//enables all kind of input actions on this image (click, etc)
image.inputEnabled=true;
// Moves the image anchor to the middle, so it centers inside the game properly
image.anchor.set(0.5);
image.events.onInputDown.add(listener,this);
// Enables all kind of input actions on this image (click, etc)
image.inputEnabled = true;
text = game.add.text(250, 16, '', { fill: '#ffffff' });
image.events.onInputDown.add(listener, this);
}
function listener () {
alert('clicked');
counter++;
text.text = "You clicked " + counter + " times!";
}