New Group.destroy example and patched the desyrel font xml.

This commit is contained in:
photonstorm
2013-12-30 21:36:50 +00:00
parent ce4cf531d4
commit ba74bea4b4
6 changed files with 103 additions and 12 deletions
+1 -1
View File
@@ -99,7 +99,7 @@
<char id="46" x="214" y="391" width="13" height="13" xoffset="3" yoffset="54" xadvance="11" page="0" chnl="0" letter="."/>
<char id="95" x="228" y="391" width="46" height="12" xoffset="-2" yoffset="63" xadvance="35" page="0" chnl="0" letter="_"/>
<char id="45" x="275" y="391" width="29" height="11" xoffset="9" yoffset="46" xadvance="34" page="0" chnl="0" letter="-"/>
<char id="32" x="305" y="391" width="0" height="0" xoffset="23" yoffset="81" xadvance="23" page="0" chnl="0" letter="space"/>
<char id="32" x="305" y="391" width="1" height="1" xoffset="23" yoffset="81" xadvance="23" page="0" chnl="0" letter="space"/>
</chars>
<kernings count="1816">
<kerning first="102" second="102" amount="2"/>
+54
View File
@@ -0,0 +1,54 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });
function preload() {
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('atari2', 'assets/sprites/atari800xl.png');
game.load.image('atari4', 'assets/sprites/atari800.png');
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.image('duck', 'assets/sprites/darkwing_crazy.png');
game.load.image('firstaid', 'assets/sprites/firstaid.png');
game.load.image('diamond', 'assets/sprites/diamond.png');
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
}
var group;
var sprite;
function create() {
var images = game.cache.getImageKeys();
group = game.add.group();
for (var i = 0; i < 20; i++)
{
sprite = group.create(game.world.randomX, game.world.randomY, game.rnd.pick(images));
}
sprite.x = 100;
sprite.y = 100;
game.add.tween(sprite).to( { y: 200 }, 2000, Phaser.Easing.Linear.None, true, 0, 1000, true);
game.input.onDown.addOnce(nuke, this);
}
function nuke() {
// The optional parameter here will destroy the Sprites as well as the Group.
// The default is 'false' which means destroy the Group, but none of the children.
group.destroy(true);
console.log(group);
console.log(sprite);
}
function render() {
game.debug.renderText('Click to nuke', 32, 32);
}