mirror of
https://github.com/photonstorm/phaser
synced 2024-12-04 02:20:23 +00:00
32 lines
572 B
JavaScript
32 lines
572 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.renderRectangle(sprite.getLocalBounds(), 'rgb(255, 255, 255)', false);
|
|
|
|
}
|