Testing new Image object.

This commit is contained in:
photonstorm
2014-02-06 19:34:05 +00:00
parent 4ed20e0f77
commit 3748811d11
8 changed files with 665 additions and 40 deletions
+45
View File
@@ -0,0 +1,45 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('pic', 'assets/pics/backscroll.png');
}
var image;
var sprite;
function create() {
console.log('wtf');
image = game.add.image(game.world.centerX, game.world.centerY, 'pic');
image.anchor.set(0.5);
// sprite = game.add.sprite(game.world.centerX, game.world.centerY, 'pic');
// sprite.anchor.set(0.5);
game.input.onDown.add(tint, this);
}
function tint() {
image.tint = Math.random() * 0xFFFFFF;
// sprite.tint = Math.random() * 0xFFFFFF;
}
function update() {
image.angle += 1;
// sprite.angle += 1;
}
function render() {
// game.debug.renderText(sprite.position.y, 32, 32);
}
+39
View File
@@ -0,0 +1,39 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('pic', 'assets/pics/backscroll.png');
}
var image;
var image2;
function create() {
image = game.add.image(32, 50, 'pic');
image2 = game.add.image(32, 250, 'pic');
game.input.onDown.add(tint, this);
}
function tint() {
image.tint = Math.random() * 0xFFFFFF;
}
function update() {
// image.angle += 1;
}
function render() {
// game.debug.renderText(sprite.position.y, 32, 32);
}