mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
42 lines
924 B
TypeScript
42 lines
924 B
TypeScript
/// <reference path="../../Phaser/Game.ts" />
|
|
|
|
(function () {
|
|
|
|
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
|
|
|
|
function preload() {
|
|
|
|
// Using Phasers asset loader we load up a PNG from the assets folder
|
|
game.load.image('sprite', 'assets/sprites/shinyball.png');
|
|
|
|
|
|
}
|
|
|
|
var sprite: Phaser.Sprite;
|
|
|
|
function create() {
|
|
|
|
// Create a load of sprites
|
|
for (var i = 0; i < 26; i++)
|
|
{
|
|
var tempSprite: Phaser.Sprite = game.add.sprite(i * 32, 100, 'sprite');
|
|
tempSprite.input.start(0, false, true);
|
|
tempSprite.events.onInputOver.add(dropSprite, this);
|
|
}
|
|
|
|
}
|
|
|
|
function dropSprite(sprite: Phaser.Sprite) {
|
|
|
|
sprite.body.velocity.y = 300;
|
|
sprite.input.enabled = false;
|
|
|
|
}
|
|
|
|
function render() {
|
|
|
|
Phaser.DebugUtils.renderInputInfo(32, 32);
|
|
|
|
}
|
|
|
|
})();
|