* 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:
photonstorm
2013-10-28 10:17:36 +00:00
parent ea651113df
commit a814cc26cc
12 changed files with 79 additions and 41 deletions
+3
View File
@@ -44,6 +44,9 @@ function create() {
sprite = game.add.sprite(400, 550, 'phaser');
// Stop the following keys from propagating up to the browser
game.input.keyboard.addKeyCapture([ Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT, Phaser.Keyboard.SPACEBAR ]);
}
function update() {
+2
View File
@@ -37,6 +37,8 @@ function create() {
c.body.immovable = true;
}
game.input.keyboard.addKeyCapture([ Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT, Phaser.Keyboard.UP, Phaser.Keyboard.DOWN ]);
}
function update() {
+1 -1
View File
@@ -52,7 +52,7 @@ function test2 () {
sprite1.body.immovable = true;
// sprite1.body.setSize(100, 100, 0, 0);
sprite2 = game.add.sprite(-100, 150, 'mushroom');
sprite2 = game.add.sprite(-100, 140, 'mushroom');
sprite2.name = 'mushroom';
sprite3 = game.add.sprite(-200, 150, 'flectrum');
+1 -1
View File
@@ -12,7 +12,7 @@
<div class="header">
<div class="box100 no-padding">
<div class="phaser-version">
<span>Phaser Version: 1.1</span>
<span>Phaser Version: 1.1.2</span>
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
</div>
</div>
+1 -1
View File
@@ -19,7 +19,7 @@
</div>
<div id="footer">
<p id="total">Total examples: </p>
<p>Phaser version: 1.1</p>
<p>Phaser version: 1.1.2</p>
<p><a href="index.html">Switch to Full View</a></p>
</div>
+13 -4
View File
@@ -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);
}