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);
|
2013-05-29 14:45:34 +00:00
|
|
|
|
2013-08-08 03:35:13 +00:00
|
|
|
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('fuji', 'assets/pics/atari_fujilogo.png');
|
2013-08-08 03:35:13 +00:00
|
|
|
|
2013-05-29 14:45:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var fuji: Phaser.Sprite;
|
|
|
|
var tweenUp: Phaser.Tween;
|
|
|
|
var tweenDown: Phaser.Tween;
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
|
|
|
game.stage.backgroundColor = 'rgb(0,0,100)';
|
|
|
|
|
|
|
|
// Here we'll assign the new sprite to the local fuji variable
|
|
|
|
fuji = game.add.sprite(game.stage.centerX, game.stage.centerY, 'fuji');
|
|
|
|
|
|
|
|
// The sprite is 320 x 200 pixels in size
|
|
|
|
// Here we set the origin to the center of the sprite again, so we can rotate and scale it at the same time
|
2013-08-02 17:32:26 +00:00
|
|
|
fuji.transform.origin.setTo(0.5, 0.5);
|
2013-05-29 14:45:34 +00:00
|
|
|
|
2013-06-06 01:47:08 +00:00
|
|
|
game.add.tween(fuji).to({ rotation: 360 }, 2000, Phaser.Easing.Linear.None, true, 0, true);
|
2013-05-29 14:45:34 +00:00
|
|
|
|
2013-06-06 01:47:08 +00:00
|
|
|
tweenUp = game.add.tween(fuji.transform.scale);
|
2013-05-29 14:45:34 +00:00
|
|
|
tweenUp.onComplete.add(scaleDown, this);
|
|
|
|
|
2013-06-06 01:47:08 +00:00
|
|
|
tweenDown = game.add.tween(fuji.transform.scale);
|
2013-05-29 14:45:34 +00:00
|
|
|
tweenDown.onComplete.add(scaleUp, this);
|
|
|
|
|
|
|
|
scaleUp();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function scaleUp() {
|
|
|
|
|
|
|
|
tweenUp.to({ x: 2, y: 2 }, 1000, Phaser.Easing.Elastic.Out);
|
|
|
|
tweenUp.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function scaleDown() {
|
|
|
|
|
|
|
|
tweenDown.to({ x: 0.5, y: 0.5 }, 1000, Phaser.Easing.Elastic.Out);
|
|
|
|
tweenDown.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|