mirror of
https://github.com/wassname/phaser.git
synced 2026-07-15 01:11:26 +08:00
23 lines
696 B
JavaScript
23 lines
696 B
JavaScript
/// <reference path="../../Phaser/Game.ts" />
|
|
(function () {
|
|
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create);
|
|
function init() {
|
|
myGame.loader.addImageFile('atari', 'assets/sprites/atari130xe.png');
|
|
myGame.loader.load();
|
|
}
|
|
var atari;
|
|
function create() {
|
|
atari = myGame.createSprite(300, 0, 'atari');
|
|
startBounceTween();
|
|
}
|
|
function startBounceTween() {
|
|
atari.y = 0;
|
|
var bounce = myGame.createTween(atari);
|
|
bounce.to({
|
|
y: 500
|
|
}, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
|
|
bounce.onComplete.add(startBounceTween, this);
|
|
bounce.start();
|
|
}
|
|
})();
|