mirror of
https://github.com/wassname/phaser.git
synced 2026-08-12 12:20:38 +08:00
Loads of new examples, some more bug fixes, all of them work beautifully
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
$title = "Destoying a sprite";
|
||||
require('../head.php');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create});
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('plane', 'assets/misc/boss1.png');
|
||||
game.load.image('sky', 'assets/tests/sky-2x.png');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.sprite(0, 0, 'sky');
|
||||
|
||||
for(var i=0;i<15;i++){
|
||||
|
||||
var sprite=game.add.sprite(game.world.randomX, game.world.randomY, 'plane');
|
||||
sprite.inputEnabled=true;
|
||||
sprite.input.useHandCursor=true;
|
||||
sprite.events.onInputDown.add(destoyIt,this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
function destoyIt (sprite) {
|
||||
|
||||
sprite.destroy();
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
require('../foot.php');
|
||||
?>
|
||||
Reference in New Issue
Block a user