2013-06-01 01:49:41 +00:00
|
|
|
/// <reference path="../../Phaser/Game.ts" />
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
|
2013-08-08 03:35:13 +00:00
|
|
|
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
|
2013-06-01 01:49:41 +00:00
|
|
|
|
2013-08-08 03:35:13 +00:00
|
|
|
function preload() {
|
2013-06-01 01:49:41 +00:00
|
|
|
|
|
|
|
// Using Phasers asset loader we load up a PNG from the assets folder
|
2013-06-05 01:58:16 +00:00
|
|
|
game.load.image('sprite', 'assets/sprites/shinyball.png');
|
2013-08-08 03:35:13 +00:00
|
|
|
|
2013-06-01 01:49:41 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var sprite: Phaser.Sprite;
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
|
|
|
// Create a load of sprites
|
|
|
|
for (var i = 0; i < 26; i++)
|
|
|
|
{
|
2013-06-07 06:35:28 +00:00
|
|
|
var tempSprite: Phaser.Sprite = game.add.sprite(i * 32, 100, 'sprite');
|
|
|
|
tempSprite.input.start(0, false, true);
|
2013-06-01 01:49:41 +00:00
|
|
|
tempSprite.events.onInputOver.add(dropSprite, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function dropSprite(sprite: Phaser.Sprite) {
|
|
|
|
|
|
|
|
sprite.body.velocity.y = 300;
|
|
|
|
sprite.input.enabled = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
2013-08-06 23:00:12 +00:00
|
|
|
Phaser.DebugUtils.renderInputInfo(32, 32);
|
2013-06-01 01:49:41 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|