2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }, false);
|
|
|
|
|
|
|
|
function preload() {
|
|
|
|
|
|
|
|
game.load.image('pic', 'assets/pics/backscroll.png');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var sprite;
|
|
|
|
var sprite2;
|
|
|
|
var g;
|
|
|
|
var p;
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
2014-02-10 02:14:59 +00:00
|
|
|
// game.stage.backgroundColor = '#ff5500';
|
2014-02-09 13:36:02 +00:00
|
|
|
|
2014-02-10 02:14:59 +00:00
|
|
|
// game.renderer.useFillRect = false;
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
sprite = game.add.sprite(0.5, 0, 'pic');
|
2014-02-10 02:14:59 +00:00
|
|
|
// sprite2 = game.add.sprite(0, 300, 'pic');
|
2014-02-09 13:36:02 +00:00
|
|
|
|
2014-02-10 02:14:59 +00:00
|
|
|
sprite.inputEnabled = true;
|
|
|
|
sprite.events.onInputDown.add(tint, this);
|
|
|
|
sprite.events.onInputUp.add(wibble, this);
|
2014-02-09 13:36:02 +00:00
|
|
|
|
|
|
|
// game.add.tween(sprite).to({y: 500}, 3000, Phaser.Easing.Linear.None, true);
|
|
|
|
|
|
|
|
// p = new PIXI.Point(43, 45);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function tint() {
|
|
|
|
|
|
|
|
sprite.destroy();
|
|
|
|
// sprite.tint = Math.random() * 0xFFFFFF;
|
|
|
|
// sprite2.tint = Math.random() * 0xFFFFFF;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-10 02:14:59 +00:00
|
|
|
function wibble() {
|
|
|
|
|
|
|
|
console.log(sprite);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-09 13:36:02 +00:00
|
|
|
function update() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
|
|
|
// game.debug.renderText(sprite.position.y, 32, 32);
|
|
|
|
|
|
|
|
}
|