mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
54 lines
904 B
JavaScript
54 lines
904 B
JavaScript
|
|
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() {
|
|
|
|
game.stage.backgroundColor = '#ff5500';
|
|
|
|
sprite = game.add.sprite(0, -200, 'pic');
|
|
|
|
// g = game.add.group(null, 'billy');
|
|
|
|
// sprite2 = g.create(0, 0, 'pic');
|
|
|
|
// g.y = 200;
|
|
// g.rotation = 0.1;
|
|
|
|
sprite2 = game.add.sprite(0, 300, 'pic');
|
|
|
|
// game.input.onDown.add(tint, this);
|
|
|
|
game.add.tween(sprite).to({y: 500}, 3000, Phaser.Easing.Linear.None, true);
|
|
|
|
p = new PIXI.Point(43, 45);
|
|
|
|
}
|
|
|
|
function tint() {
|
|
|
|
// sprite.tint = Math.random() * 0xFFFFFF;
|
|
// sprite2.tint = Math.random() * 0xFFFFFF;
|
|
|
|
}
|
|
|
|
function update() {
|
|
|
|
|
|
}
|
|
|
|
function render() {
|
|
|
|
// game.debug.renderText(sprite.position.y, 32, 32);
|
|
|
|
}
|