2013-10-22 02:58:20 +00:00
|
|
|
|
2013-10-24 03:27:28 +00:00
|
|
|
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
function preload() {
|
|
|
|
game.load.image('trsi', 'assets/pics/trsipic1_lazur.jpg');
|
|
|
|
}
|
|
|
|
|
|
|
|
var pic;
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
|
|
|
pic = game.add.sprite(0, 0, 'trsi');
|
|
|
|
|
2013-10-24 03:27:28 +00:00
|
|
|
pic.cropEnabled = true;
|
|
|
|
|
|
|
|
pic.crop.width = 128;
|
|
|
|
pic.crop.height = 128;
|
2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
|
|
pic.x = game.input.x;
|
|
|
|
pic.y = game.input.y;
|
|
|
|
|
2013-10-24 03:27:28 +00:00
|
|
|
pic.crop.x = game.input.x;
|
|
|
|
pic.crop.y = game.input.y;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
|
|
|
game.debug.renderText('x: ' + game.input.x + ' y: ' + game.input.y, 32, 32);
|
2013-10-22 02:58:20 +00:00
|
|
|
|
|
|
|
}
|