mirror of
https://github.com/wassname/phaser.git
synced 2026-09-11 12:31:29 +08:00
Updating and fixing tests
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/// <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();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,36 @@
|
||||
/// <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: Phaser.Sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
atari = game.add.sprite(300, 0, 'atari');
|
||||
|
||||
startBounceTween();
|
||||
}
|
||||
|
||||
function startBounceTween() {
|
||||
|
||||
atari.y = 0;
|
||||
|
||||
var bounce: Phaser.Tween = game.add.tween(atari);
|
||||
|
||||
bounce.to({ y: 500 }, 1000 + Math.random() * 3000, Phaser.Easing.Bounce.Out);
|
||||
bounce.onComplete.add(startBounceTween, this);
|
||||
bounce.start();
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path="../../Phaser/Game.ts" />
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(this, 'game', 800, 600, init, create);
|
||||
|
||||
function init() {
|
||||
@@ -7,8 +9,11 @@
|
||||
game.load.spritesheet('PHASER', 'assets/tests/tween/PHASER.png', 70, 90);
|
||||
game.load.start();
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
var item: Phaser.Sprite;
|
||||
|
||||
for (var i = 0; i < 6; i++) {
|
||||
item = game.add.sprite(190 + 69 * i, -100, 'PHASER', i);
|
||||
// Add a simple bounce tween to each character's position.
|
||||
@@ -18,5 +23,7 @@
|
||||
|
||||
// Set background color to white.
|
||||
game.stage.backgroundColor = '#fff';
|
||||
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user