mirror of
https://github.com/wassname/phaser.git
synced 2026-08-03 13:10:25 +08:00
Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('ball', 'assets/sprites/pangball.png');
|
||||
|
||||
}
|
||||
|
||||
var t;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#6688ee';
|
||||
|
||||
t = game.time.create(false);
|
||||
|
||||
t.repeat(Phaser.Timer.SECOND * 2, 10, createBall, this);
|
||||
t.repeat(Phaser.Timer.SECOND * 3, 10, createBall, this);
|
||||
|
||||
t.start();
|
||||
|
||||
game.input.onDown.add(killThem, this);
|
||||
|
||||
}
|
||||
|
||||
function createBall() {
|
||||
|
||||
// A bouncey ball sprite just to visually see what's going on.
|
||||
var ball = game.add.sprite(game.world.randomX, 0, 'ball');
|
||||
|
||||
ball.body.gravity.y = 200;
|
||||
ball.body.bounce.y = 0.5;
|
||||
ball.body.collideWorldBounds = true;
|
||||
|
||||
console.log('nuked');
|
||||
game.time.removeAll();
|
||||
// t.removeAll();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function killThem() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderText("Time until event: " + t.duration.toFixed(0), 32, 32);
|
||||
game.debug.renderText("Next tick: " + t.next.toFixed(0), 32, 64);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user