mirror of
https://github.com/photonstorm/phaser
synced 2024-12-04 18:40:59 +00:00
33 lines
572 B
JavaScript
33 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);
|
||
|
|
||
|
}
|