mirror of
https://github.com/wassname/phaser.git
synced 2026-09-12 12:40:47 +08:00
Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting.
This commit is contained in:
@@ -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.spritesheet('gameboy', 'assets/sprites/gameboy_seize_color_40x60.png', 40, 60);
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#124184';
|
||||
|
||||
game.physics.gravity.y = 200;
|
||||
|
||||
sprite = game.add.sprite(200, 250, 'gameboy', 4);
|
||||
sprite.name = 'green';
|
||||
sprite.body.collideWorldBounds = true;
|
||||
// sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
sprite.body.bounce.setTo(0.9, 0.9);
|
||||
sprite.body.velocity.x = 150;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// sprite.worldTransform[2] += 1;
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite, 32, 32);
|
||||
game.debug.renderPhysicsBody(sprite.body);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user