mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
32 lines
561 B
JavaScript
32 lines
561 B
JavaScript
|
|
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/sprites/exocet_spaceman.png');
|
|
|
|
}
|
|
|
|
var sprite;
|
|
|
|
function create() {
|
|
|
|
game.stage.backgroundColor = '#997683';
|
|
|
|
sprite = game.add.sprite(game.world.centerX, game.world.centerY, 'pic');
|
|
sprite.anchor.setTo(0.5);
|
|
|
|
}
|
|
|
|
|
|
function update() {
|
|
|
|
sprite.rotation += 0.01;
|
|
|
|
}
|
|
|
|
function render() {
|
|
|
|
game.debug.geom(sprite.getLocalBounds(), 'rgb(255, 255, 255)', false);
|
|
|
|
}
|