mirror of
https://github.com/wassname/phaser.git
synced 2026-09-10 12:29:30 +08:00
* Fixed issue 135 - Added typeof checks into most ArcadePhysics functions to avoid errors with zero values.
* Fixed issue 136 - distanceTo using worldX/Y instead of x/y.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
@@ -54,7 +54,7 @@ function create() {
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
|
||||
// game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
|
||||
@@ -80,7 +80,7 @@ function particleBurst() {
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite, layer);
|
||||
// game.physics.collide(sprite, layer);
|
||||
game.physics.collide(emitter, layer);
|
||||
|
||||
sprite.body.velocity.x = 0;
|
||||
@@ -88,7 +88,7 @@ function update() {
|
||||
|
||||
if (cursors.up.isDown)
|
||||
{
|
||||
sprite.body.velocity.y = -150;
|
||||
sprite.body.velocity.y = -150;
|
||||
}
|
||||
else if (cursors.down.isDown)
|
||||
{
|
||||
@@ -107,3 +107,12 @@ function update() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.renderSpriteCorners(sprite);
|
||||
// game.debug.renderSpriteInfo(sprite, 32, 32);
|
||||
game.debug.renderSpriteCoords(sprite, 32, 32);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user