phaser/wip/TS Tests/particles/mousetrail.ts
2013-09-13 16:24:01 +01:00

46 lines
1 KiB
TypeScript

/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
var emitter: Phaser.ArcadeEmitter;
function preload() {
game.load.image('jet', 'assets/sprites/particle1.png');
game.load.image('starfield', 'assets/misc/starfield.jpg');
}
var scroller: Phaser.ScrollZone;
var emitter: Phaser.ArcadeEmitter;
function create() {
scroller = game.add.scrollZone('starfield', 0, 0, 1024, 1024);
scroller.setSpeed(0, -1);
emitter = game.add.emitter(game.stage.centerX, game.stage.centerY);
emitter.makeParticles('jet', 200);
emitter.texture.globalCompositeOperation = 'lighter';
emitter.gravity = 300;
emitter.setXSpeed(-50, 50);
emitter.setYSpeed(-50, -100);
emitter.setRotation(0, 0);
emitter.start(false, 50, 0.02);
}
function update() {
emitter.x = game.input.x;
emitter.y = game.input.y;
//emitter.em
}
})();