2013-05-29 14:45:34 +00:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
|
|
|
(function () {
|
|
|
|
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
|
|
|
|
function init() {
|
|
|
|
// Using Phasers asset loader we load up a PNG from the assets folder
|
2013-06-05 01:58:16 +00:00
|
|
|
game.load.image('swirl', 'assets/pics/color_wheel_swirl.png');
|
|
|
|
game.load.start();
|
2013-05-29 14:45:34 +00:00
|
|
|
}
|
|
|
|
var swirl;
|
|
|
|
function create() {
|
|
|
|
// Here we'll assign the new sprite to the local swirl variable
|
|
|
|
swirl = game.add.sprite(game.stage.centerX, game.stage.centerY, 'swirl');
|
|
|
|
// Increase the size of the sprite a little so it covers the edges of the stage
|
2013-06-06 01:47:08 +00:00
|
|
|
swirl.transform.scale.setTo(1.4, 1.4);
|
2013-05-31 18:28:16 +00:00
|
|
|
// Set the origin to the middle of the Sprite to get the effect we need
|
2013-06-06 01:47:08 +00:00
|
|
|
swirl.transform.origin.setTo(swirl.worldView.halfWidth, swirl.worldView.halfHeight);
|
2013-05-29 14:45:34 +00:00
|
|
|
// Create a tween that rotates a full 306 degrees and then repeats (loop set to true)
|
2013-05-31 18:28:16 +00:00
|
|
|
game.add.tween(swirl).to({
|
2013-06-06 01:47:08 +00:00
|
|
|
rotation: 360
|
2013-05-31 18:28:16 +00:00
|
|
|
}, 2000, Phaser.Easing.Linear.None, true, 0, true);
|
2013-06-06 01:47:08 +00:00
|
|
|
game.add.tween(swirl.transform.scale).to({
|
2013-05-29 14:45:34 +00:00
|
|
|
x: 4,
|
|
|
|
y: 4
|
|
|
|
}, 1000, Phaser.Easing.Linear.None, true, 0, true, true);
|
|
|
|
}
|
|
|
|
})();
|