2013-05-29 14:45:34 +00:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
|
|
|
(function () {
|
2013-08-08 03:35:13 +00:00
|
|
|
var game = new Phaser.Game(this, 'game', 800, 600, preload, create);
|
|
|
|
function preload() {
|
2013-05-29 14:45:34 +00:00
|
|
|
// 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');
|
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-08-08 05:08:53 +00:00
|
|
|
swirl.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-08-08 05:08:53 +00:00
|
|
|
swirl.origin.setTo(0.5, 0.5);
|
|
|
|
// Create a tween that rotates a full 360 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
|
2013-08-08 05:08:53 +00:00
|
|
|
}, 4000, Phaser.Easing.Linear.None, true, 0, true, true);
|
2013-05-29 14:45:34 +00:00
|
|
|
}
|
|
|
|
})();
|