Files
photonstorm 3c631768f2 Explicitly paused Timer continues if you un-focus and focus the browser window (thanks georgiee)
Added TimerEvent.pendingDelete and checks in Timer.update, so that removing an event in a callback no longer throws an exception (thanks georgiee)
Fixed TypeScript defs on lines 1741-1748 (thanks wombatbuddy)
Added SAT.js to TypeScript definition. Now compiles properly.
Added missing Line.js to the Grunt file.
Tilemap#paste diffX and diffY equations changed, fixed issue #393 (thanks brejep)
Added missing return value in Body.hitLeft and hitRight, fixes issue #398 (thanks ram64).
Fixed easing tween example case. Issue #379 (thanks wesleywerner)
Removed SAT.js UMD wrapped, fixes issue #361 (thanks luizbills)
2014-02-12 15:09:44 +00:00

47 lines
1.5 KiB
JavaScript

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
function preload() {
game.load.spritesheet('shadow', 'assets/tests/tween/shadow.png', 138, 15);
game.load.spritesheet('phaser', 'assets/tests/tween/PHASER.png', 70, 90);
}
function create() {
var item;
var shadow;
var tween;
// Sets background color to white.
game.stage.backgroundColor = '#ffffff';
for (var i = 0; i < 6; i++)
{
// Add a shadow to the location which characters will land on.
// And tween their size to make them look like a real shadow.
// Put the following code before items to give shadow a lower
// render order.
shadow = game.add.sprite(190 + 69 * i, 284, 'shadow');
// Set shadow's size 0 so that it'll be invisible at the beginning.
shadow.scale.setTo(0.0, 0.0);
// Also set the origin to the center since we don't want to
// see the shadow scale to the left top.
shadow.anchor.setTo(0.5, 0.5);
game.add.tween(shadow.scale).to({x: 1.0, y: 1.0}, 2400, Phaser.Easing.Bounce.Out);
// Add characters on top of shadows.
item = game.add.sprite(190 + 69 * i, -100, 'phaser', i);
// Set origin to the center to make the rotation look better.
item.anchor.setTo(0.5, 0.5);
// Add a simple bounce tween to each character's position.
tween = game.add.tween(item).to({y: 240}, 2400, Phaser.Easing.Bounce.Out);
}
}