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