diff --git a/examples/assets/tilemaps/maps/features_test.json b/examples/assets/tilemaps/maps/features_test.json index f0610494..91c7bba3 100644 --- a/examples/assets/tilemaps/maps/features_test.json +++ b/examples/assets/tilemaps/maps/features_test.json @@ -2,7 +2,7 @@ "layers":[ { "height":18, - "image":"..\/sprites\/bunny.png", + "image":"..\/..\/sprites\/bunny.png", "name":"Image Layer 1", "opacity":1, "properties": @@ -18,7 +18,7 @@ "y":0 }, { - "data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "height":18, "name":"Tile Layer 1", "opacity":1, @@ -259,7 +259,7 @@ "tilesets":[ { "firstgid":1, - "image":"ground_1x1.png", + "image":"..\/tiles\/ground_1x1.png", "imageheight":32, "imagewidth":800, "margin":0, @@ -281,7 +281,7 @@ }, { "firstgid":26, - "image":"walls_1x2.png", + "image":"..\/tiles\/walls_1x2.png", "imageheight":64, "imagewidth":256, "margin":0, @@ -296,7 +296,7 @@ }, { "firstgid":34, - "image":"..\/sprites\/coin.png", + "image":"..\/..\/sprites\/coin.png", "imageheight":32, "imagewidth":192, "margin":0, @@ -311,7 +311,7 @@ }, { "firstgid":40, - "image":"tiles2.png", + "image":"..\/tiles\/tiles2.png", "imageheight":910, "imagewidth":840, "margin":0, diff --git a/examples/assets/tilemaps/tmx/features test.tmx b/examples/assets/tilemaps/tmx/features test.tmx index 71cefe2e..60cac68e 100644 --- a/examples/assets/tilemaps/tmx/features test.tmx +++ b/examples/assets/tilemaps/tmx/features test.tmx @@ -29,7 +29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EAAAABAAAAAQAAAAEAAAABAAAACQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAA diff --git a/examples/wip/rabbit map.js b/examples/wip/rabbit map.js index 85420dc1..78a88e3d 100644 --- a/examples/wip/rabbit map.js +++ b/examples/wip/rabbit map.js @@ -8,7 +8,8 @@ function preload() { game.load.image('walls_1x2', 'assets/tilemaps/tiles/walls_1x2.png'); game.load.image('tiles2', 'assets/tilemaps/tiles/tiles2.png'); - game.load.image('phaser', 'assets/sprites/shinyball.png'); + // game.load.image('phaser', 'assets/sprites/shinyball.png'); + game.load.image('phaser', 'assets/sprites/firstaid.png'); // game.load.image('phaser', 'assets/sprites/atari130xe.png'); // game.load.image('phaser', 'assets/sprites/mushroom2.png'); @@ -23,13 +24,18 @@ var layer2; var layer3; var sprite; +var marker; function create() { +console.log(' --- state create start ---'); + $('#step').click(function(){ game.step(); }); + marker = new Phaser.Line(256, 0, 256, 600); + map = game.add.tilemap('map'); map.addTilesetImage('ground_1x1'); @@ -42,12 +48,22 @@ function create() { // layer.debug = true; - layer.resizeWorld(); + // layer.resizeWorld(); + + game.physics.gravity.y = 200; + + + sprite = game.add.sprite(100, 300, 'phaser'); // up test + + // sprite = game.add.sprite(200, 240, 'phaser'); // 3-block corner test - sprite = game.add.sprite(170, 450, 'phaser'); sprite.debug = true; - sprite.body.velocity.x = 200; + game.stepping = true; + + // sprite.body.velocity.y = -300; + + sprite.body.velocity.y = 200; // sprite.anchor.setTo(0.5, 0.5); @@ -63,7 +79,7 @@ function create() { // sprite.angle = 35; - game.camera.follow(sprite); + // game.camera.follow(sprite); // game.input.onDown.add(getIt, this); @@ -73,6 +89,8 @@ function create() { function update() { +console.log(' --- state update start ---'); + /* if (cursors.left.isDown) { @@ -94,6 +112,8 @@ function update() { */ game.physics.collide(sprite, layer); + // sprite.body.velocity.y = -300; + // sprite.body.velocity.x = 0; // sprite.body.velocity.y = 0; // sprite.body.angularVelocity = 0; @@ -137,7 +157,8 @@ function update() { if (cursors.up.isDown) { - sprite.body.velocity.y = -100; + console.log('cursor up'); + sprite.body.velocity.y = -300; } else if (cursors.down.isDown) { @@ -161,9 +182,11 @@ function render() { // game.debug.renderSpriteBody(sprite); // game.debug.renderSpriteBounds(sprite); - game.debug.renderPhysicsBody(sprite.body); + // game.debug.renderPhysicsBody(sprite.body); game.debug.renderBodyInfo(sprite, 32, 32); + // game.debug.renderLine(marker, 'rgba(255,255,255,0.5)'); + // game.debug.renderText(sprite.deltaX, 32, 32); // game.debug.renderText(sprite.deltaY, 32, 48); // game.debug.renderText(sprite.body.deltaX(), 232, 32); diff --git a/src/PixiPatch.js b/src/PixiPatch.js index e7dd50c9..d7bfde7c 100644 --- a/src/PixiPatch.js +++ b/src/PixiPatch.js @@ -66,13 +66,21 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject, rend { this.context.globalAlpha = displayObject.worldAlpha; + // this.context.setTransform( + // displayObject.worldTransform[0], + // displayObject.worldTransform[3], + // displayObject.worldTransform[1], + // displayObject.worldTransform[4], + // displayObject.worldTransform[2], + // displayObject.worldTransform[5]); + this.context.setTransform( displayObject.worldTransform[0], displayObject.worldTransform[3], displayObject.worldTransform[1], displayObject.worldTransform[4], - displayObject.worldTransform[2], - displayObject.worldTransform[5]); + Math.floor(displayObject.worldTransform[2]), + Math.floor(displayObject.worldTransform[5])); if (displayObject.texture.trimmed) { diff --git a/src/core/Game.js b/src/core/Game.js index 18d0f2b2..d13b0a61 100644 --- a/src/core/Game.js +++ b/src/core/Game.js @@ -284,7 +284,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant } this.pendingStep = false; - this.stepping = true; + this.stepping = false; this.stepCount = 0; return this; @@ -599,9 +599,9 @@ Phaser.Game.prototype = { this.input.update(); this.tweens.update(); this.sound.update(); - console.log('state update'); + // console.log('state update'); this.state.update(); - console.log('world update'); + // console.log('world update'); this.world.update(); this.particles.update(); this.plugins.update(); @@ -635,7 +635,8 @@ Phaser.Game.prototype = { this.pendingStep = false; this.stepCount++; - console.log('--------- Game step', this.stepCount); + console.log(''); + console.log('----------------------------- Game step', this.stepCount); }, diff --git a/src/core/World.js b/src/core/World.js index 74a06bfa..6a33dae1 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -143,6 +143,9 @@ Phaser.World.prototype.postUpdate = function () { } while (currentNode != this.game.stage._stage.last._iNext) } + + this.camera.update(); + } /** diff --git a/src/physics/arcade/ArcadePhysics.js b/src/physics/arcade/ArcadePhysics.js index 8ebdd285..b01824bd 100644 --- a/src/physics/arcade/ArcadePhysics.js +++ b/src/physics/arcade/ArcadePhysics.js @@ -188,11 +188,13 @@ Phaser.Physics.Arcade.prototype = { { body.blocked.left = true; part.pos.add(this._response.overlapV); + console.log('World checkBounds Left', this._response.overlapV); } else if (this.worldRight && test(this.worldPolys[1], part, this._response)) { body.blocked.right = true; part.pos.add(this._response.overlapV); + console.log('World checkBounds Right', this._response.overlapV); } this._response.clear(); @@ -201,11 +203,13 @@ Phaser.Physics.Arcade.prototype = { { body.blocked.up = true; part.pos.add(this._response.overlapV); + console.log('World checkBounds Up', this._response.overlapV); } else if (this.worldBottom && test(this.worldPolys[3], part, this._response)) { body.blocked.down = true; part.pos.add(this._response.overlapV); + console.log('World checkBounds Down', this._response.overlapV); } }, @@ -364,6 +368,11 @@ Phaser.Physics.Arcade.prototype = { // pos = pos + dt*(vel + temp/2) // vel = vel + temp + if (body.sprite.debug) + { + console.log('updateMotion: acx', body.acceleration.x, 'acy', body.acceleration.y, 'gravx', this._gravityX, 'gravy', this._gravityY, 'elapsed', this.game.time.physicsElapsed); + } + this._p.setTo((body.acceleration.x + this._gravityX) * this.game.time.physicsElapsed, (body.acceleration.y + this._gravityY) * this.game.time.physicsElapsed); return this._p; @@ -706,7 +715,9 @@ Phaser.Physics.Arcade.prototype = { */ collideSpriteVsTilemapLayer: function (sprite, tilemapLayer, collideCallback, processCallback, callbackContext) { - console.log('collideSpriteVsTilemapLayer x:', sprite.x, 'y:', sprite.y, 'body left:', sprite.body.left, 'right:', sprite.body.right); + // At this stage the body.left value is WRONG (it's the old value) + // console.log('collideSpriteVsTilemapLayer sx:', sprite.x, 'sy:', sprite.y, 'body left:', sprite.body.left, 'right:', sprite.body.right); + console.log('collideSpriteVsTilemapLayer x:', sprite.body.x, 'y:', sprite.body.y, 'body left:', sprite.body.left, 'right:', sprite.body.right); this._mapData = tilemapLayer.getTiles(sprite.body.left, sprite.body.top, sprite.body.width, sprite.body.height, true); @@ -845,7 +856,7 @@ Phaser.Physics.Arcade.prototype = { /** * Performs a rect intersection test against the two objects. * Objects must expose properties: width, height, left, right, top, bottom. - * @method Phaser.Physics.Arcade#intersects + * @method Phaser.Physics.Arcade#tileIntersects * @param {object} body - The Body to test. * @param {object} tile - The Tile to test. * @returns {boolean} Returns true if the objects intersect, otherwise false. @@ -854,22 +865,30 @@ Phaser.Physics.Arcade.prototype = { if (body.width <= 0 || body.height <= 0 || tile.width <= 0 || tile.height <= 0) { - return false; + return null; } - // console.log('body: ', body.left, body.top, body.right, body.bottom); - // console.log('tile: ', tile.x, tile.y, tile.right, tile.bottom); - + console.log('____ tileIntersects'); + console.log('body: ', body.left, body.top, body.right, body.bottom); + console.log('tile: ', tile.x, tile.y, tile.right, tile.bottom); // console.log('intersect #1', body.right < tile.x, body.right, tile.x); // console.log('intersect #2', body.bottom < tile.y, body.bottom, tile.y); // console.log('intersect #3', body.left > tile.right, body.left, tile.right); // console.log('intersect #4', body.top > tile.bottom, body.top, tile.bottom); - // return !(a.right < b.x || a.bottom < b.y || a.x > b.right || a.y > b.bottom); + if (!(body.right < tile.x || body.bottom < tile.y || body.left > tile.right || body.top > tile.bottom)) + { + var out = [0,0,0,0]; - result = !(body.right < tile.x || body.bottom < tile.y || body.left > tile.right || body.top > tile.bottom); + out[0]= Math.max(body.left, tile.x); // x + out[1] = Math.max(body.top, tile.y); // y + out[2] = Math.min(body.right, tile.right) - out[0]; // width + out[3] = Math.min(body.bottom, tile.bottom) - out[1]; // height - return result; + return out; + } + + return null; }, @@ -878,152 +897,51 @@ Phaser.Physics.Arcade.prototype = { * @method Phaser.Physics.Arcade#separateTiles * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {array} tiles - The array of tiles to collide against. - * @returns {boolean} Returns true if the bodies were separated, otherwise false. + * @returns {boolean} Returns true if the body was separated, otherwise false. */ separateTiles: function (body, tiles) { - // Can't separate two immovable objects (tiles are always immovable) - if (body.immovable) - { - return false; - } - - body.overlapX = 0; - body.overlapY = 0; + console.log('!!! separateTiles', tiles); var tile; - var localOverlapX = 0; - var localOverlapY = 0; - var process = false; + var result = false; for (var i = 0; i < tiles.length; i++) { tile = tiles[i]; - if (this.tileIntersects(body, tile)) + if (this.separateTile(body, tile)) { - // They overlap. Any custom callbacks? - if (tile.tile.callback || tile.layer.callbacks[tile.tile.index]) - { - // A local callback takes priority over a global callback. - if (tile.tile.callback && tile.tile.callback.call(tile.tile.callbackContext, body.sprite, tile) === false) - { - // Is there a tile specific collision callback? If it returns true then we can carry on, otherwise we should abort. - continue; - } - else if (tile.layer.callbacks[tile.tile.index] && tile.layer.callbacks[tile.tile.index].callback.call(tile.layer.callbacks[tile.tile.index].callbackContext, body.sprite, tile) === false) - { - // Is there a tile index collision callback? If it returns true then we can carry on, otherwise we should abort. - continue; - } - } - - if (body.deltaX() < 0 && body.checkCollision.left && tile.tile.faceRight && !body.blocked.left) - { - // LEFT - localOverlapX = body.left - tile.right; - - console.log('STS left', localOverlapX, body.deltaX(), 'bt', body.left, tile.right); - - if (localOverlapX >= body.deltaX()) - { - body.blocked.left = true; - body.touching.left = true; - body.touching.none = false; - process = true; - } - } - else if (body.deltaX() > 0 && body.checkCollision.right && tile.tile.faceLeft && !body.blocked.right) - { - // RIGHT - localOverlapX = body.right - tile.x; - - console.log('STS right', localOverlapX, body.deltaX(), 'bt', body.right, tile.x); - - // Distance check - if (localOverlapX <= body.deltaX()) - { - body.blocked.right = true; - body.touching.right = true; - body.touching.none = false; - process = true; - } - } - - if (body.deltaY() < 0 && body.checkCollision.up && tile.tile.faceBottom && !body.blocked.up) - { - // UP - localOverlapY = body.top - tile.bottom; - - console.log('STS up', localOverlapY, body.deltaY(), 'bt', body.top, tile.bottom); - - // Distance check - if (localOverlapY >= body.deltaY()) - { - body.blocked.up = true; - body.touching.up = true; - body.touching.none = false; - process = true; - } - } - else if (body.deltaY() > 0 && body.checkCollision.down && tile.tile.faceTop && !body.blocked.down) - { - // DOWN - localOverlapY = body.bottom - tile.y; - - console.log('STS down', localOverlapY, body.deltaY(), 'bt', body.bottom, tile.y); - - if (localOverlapY <= body.deltaY()) - { - body.blocked.down = true; - body.touching.down = true; - body.touching.none = false; - process = true; - } - } + result = true; } } - if (localOverlapX !== 0) - { - body.overlapX = localOverlapX; - } - - if (localOverlapY !== 0) - { - body.overlapY = localOverlapY; - } - - if (process) - { - return this.processTileSeparation(body); - } - else - { - return false; - } + return result; }, /** * The core separation function to separate a physics body and a tile. * @method Phaser.Physics.Arcade#separateTile - * @param {Phaser.Physics.Arcade.Body} body1 - The Body object to separate. + * @param {Phaser.Physics.Arcade.Body} body - The Body object to separate. * @param {Phaser.Tile} tile - The tile to collide against. - * @returns {boolean} Returns true if the bodies were separated, otherwise false. + * @returns {boolean} Returns true if the body was separated, otherwise false. */ separateTile: function (body, tile) { - // Can't separate two immovable objects (tiles are always immovable) - if (body.immovable || this.tileIntersects(body, tile) === false) + var intersection = this.tileIntersects(body, tile); + + // If the intersection area is either entirely null, or has a width/height of zero, we bail out now + if (intersection === null || intersection[2] === 0 || intersection[3] === 0) { - console.log('fail'); - console.log('body: ', body.left, body.top, body.right, body.bottom); - console.log('tile: ', tile.x, tile.y, tile.right, tile.bottom); + console.log('Tile does not intersect body'); return false; } - console.log('CHECK'); + console.log('*** separateTile', tile); + console.log('intersection', intersection); + + tile.tile.debug = true; // They overlap. Any custom callbacks? if (tile.tile.callback || tile.layer.callbacks[tile.tile.index]) @@ -1041,7 +959,6 @@ Phaser.Physics.Arcade.prototype = { } } - // use body var instead body.overlapX = 0; body.overlapY = 0; @@ -1054,33 +971,30 @@ Phaser.Physics.Arcade.prototype = { console.log('ST left', body.overlapX, body.deltaX(), 'bt', body.left, tile.right); - if (body.overlapX <= body.deltaX()) + if (body.overlapX < 0) { - console.log('pass'); - body.blocked.left = true; - body.touching.left = true; - body.touching.none = false; process = true; } + else + { + body.overlapX = 0; + } } else if (body.deltaX() > 0 && body.checkCollision.right && tile.tile.faceLeft && !body.blocked.right) { // RIGHT body.overlapX = body.right - tile.x; - console.log(tile); - console.log('ST right', body.overlapX, body.deltaX(), 'bt', body.right, tile.x); - // Distance check - if (body.overlapX >= body.deltaX()) + if (body.overlapX > 0) { - console.log('pass'); - body.blocked.right = true; - body.touching.right = true; - body.touching.none = false; process = true; } + else + { + body.overlapX = 0; + } } if (body.deltaY() < 0 && body.checkCollision.up && tile.tile.faceBottom && !body.blocked.up) @@ -1090,15 +1004,14 @@ Phaser.Physics.Arcade.prototype = { console.log('ST up', body.overlapY, body.deltaY(), 'bt', body.top, tile.bottom); - // Distance check - if (body.overlapY >= body.deltaY()) + if (body.overlapY < 0) { - console.log('pass'); - body.blocked.up = true; - body.touching.up = true; - body.touching.none = false; process = true; } + else + { + body.overlapY = 0; + } } else if (body.deltaY() > 0 && body.checkCollision.down && tile.tile.faceTop && !body.blocked.down) { @@ -1107,14 +1020,27 @@ Phaser.Physics.Arcade.prototype = { console.log('ST down', body.overlapY, body.deltaY(), 'bt', body.bottom, tile.y); - if (body.overlapY <= body.deltaY()) + if (body.overlapY > 0) { - console.log('pass'); - body.blocked.down = true; - body.touching.down = true; - body.touching.none = false; process = true; } + else + { + body.overlapY = 0; + } + } + + // Only separate on the smallest of the two values if it's a single tile + if (body.overlapX !== 0 && body.overlapY !== 0) + { + if (Math.abs(body.overlapX) > Math.abs(body.overlapY)) + { + body.overlapX = 0; + } + else + { + body.overlapY = 0; + } } // Separate in a single sweep @@ -1138,30 +1064,52 @@ Phaser.Physics.Arcade.prototype = { */ processTileSeparation: function (body) { - // Swap for a hit tile? - if (body.touching.none) - { - console.log('processTileSeparation QUIT'); - return false; - } + console.log('PRE processTileSeparation xy', body.x, body.y, 'left', body.left, 'right', body.right, 'up', body.up, 'down', body.down); - console.log('pre processTileSeparation', body.x, body.y); - - if (body.touching.left || body.touching.right || body.blocked.left || body.blocked.right) + if (body.overlapX < 0) { body.x -= body.overlapX; + body.left -= body.overlapX; + body.right -= body.overlapX; + body.blocked.x = Math.floor(body.x); + body.blocked.left = true; + body.touching.left = true; + body.touching.none = false; + } + else if (body.overlapX > 0) + { + body.x -= body.overlapX; + body.left -= body.overlapX; + body.right -= body.overlapX; + body.blocked.x = Math.floor(body.x); + body.blocked.right = true; + body.touching.right = true; + body.touching.none = false; } - if (body.touching.up || body.touching.down || body.blocked.up || body.blocked.down) + if (body.overlapY < 0) { body.y -= body.overlapY; + body.top -= body.overlapY; + body.bottom -= body.overlapY; + body.blocked.y = Math.floor(body.y); + body.blocked.up = true; + body.touching.up = true; + body.touching.none = false; + + } + else if (body.overlapY > 0) + { + body.y -= body.overlapY; + body.top -= body.overlapY; + body.bottom -= body.overlapY; + body.blocked.y = Math.floor(body.y); + body.blocked.down = true; + body.touching.down = true; + body.touching.none = false; } - console.log('post processTileSeparation', body.x, body.y, body.right); - - body.setBlockFlag(body.blocked.left, body.blocked.right, body.blocked.up, body.blocked.down, body.overlapX, body.overlapY); - - // body.reboundCheck(true, true, true); + console.log('POST processTileSeparation xy', body.x, body.y, 'left', body.left, 'right', body.right, 'up', body.up, 'down', body.down); return true; diff --git a/src/physics/arcade/Body.js b/src/physics/arcade/Body.js index 2ea2f410..126988d2 100644 --- a/src/physics/arcade/Body.js +++ b/src/physics/arcade/Body.js @@ -161,6 +161,13 @@ Phaser.Physics.Arcade.Body = function (sprite) { */ this.touching = { none: true, up: false, down: false, left: false, right: false }; + /** + * This object is populated with boolean values when the Body collides with the World bounds or a Tile. + * For example if blocked.up is true then the Body cannot move up. + * @property {object} blocked - An object containing on which faces this Body is blocked from moving, if any. + */ + this.blocked = { x: 0, y: 0, up: false, down: false, left: false, right: false }; + /** * @property {number} facing - A const reference to the direction the Body is traveling or facing. * @default @@ -233,13 +240,6 @@ Phaser.Physics.Arcade.Body = function (sprite) { */ this.collideWorldBounds = false; - /** - * This object is populated with boolean values when the Body collides with the World bounds or a Tile. - * For example if blocked.up is true then the Body cannot move up. - * @property {object} blocked - An object containing on which faces this Body is blocked from moving, if any. - */ - this.blocked = { up: false, down: false, left: false, right: false }; - /** * @property {Phaser.Physics.Arcade.RECT|Phaser.Physics.Arcade.CIRCLE} type - The type of SAT Shape. */ @@ -327,11 +327,13 @@ Phaser.Physics.Arcade.Body = function (sprite) { */ this._distances = [0, 0, 0, 0]; - this.blockFlags = [0, 0, 0, 0]; - this.overlapX = 0; this.overlapY = 0; + // Velocity cache + this._vx = 0; + this._vy = 0; + // Set-up the default shape this.setRectangle(sprite.width, sprite.height, 0, 0); @@ -445,16 +447,13 @@ Phaser.Physics.Arcade.Body.prototype = { this.preX = this.x; this.preY = this.y; - - // this.x = this.sprite.center.x + this.offset.x; - // this.y = this.sprite.center.y + this.offset.y; + this.preRotation = this.rotation; this.x = this.sprite.world.x + this.offset.x; this.y = this.sprite.world.y + this.offset.y; if (this.allowRotation) { - this.preRotation = this.rotation; this.rotation = this.sprite.rotation; if (this.type !== Phaser.Physics.Arcade.CIRCLE && this.deltaZ() !== 0) @@ -463,39 +462,14 @@ Phaser.Physics.Arcade.Body.prototype = { } } - this.updateBounds(); - if (this.sprite.debug) { - console.log('Body postUpdate x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right); + console.log('Body preUpdate x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right, 'WAS', this.preX, this.preY); + console.log('Body preUpdate blocked:', this.blocked, this.blockFlags); + console.log('Body preUpdate velocity:', this.velocity.x, this.velocity.y); } - - if (this.blocked.left && this.blockFlags[0] !== this.left) - { - this.blocked.left = false; - } - - if (this.blocked.right && this.blockFlags[1] !== this.right) - { - this.blocked.right = false; - } - - if (this.blocked.up && this.blockFlags[2] !== this.top) - { - this.blocked.up = false; - } - - if (this.blocked.down && this.blockFlags[3] !== this.bottom) - { - // console.log('reset down block flag', this.blockFlags[3], this.bottom); - this.blocked.down = false; - } - - this.blocked.left = false; - this.blocked.right = false; - this.blocked.up = false; - this.blocked.down = false; + this.checkBlocked(); this.touching.none = true; this.touching.up = false; @@ -503,48 +477,60 @@ if (this.sprite.debug) this.touching.left = false; this.touching.right = false; - this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y); - this.angle = Math.atan2(this.velocity.y, this.velocity.x); - if (this.moves) { + if (this._vx !== this.velocity.x || this._vy !== this.velocity.y) + { + // No need to re-calc these if they haven't changed + this._vx = this.velocity.x; + this._vy = this.velocity.y; + this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y); + this.angle = Math.atan2(this.velocity.y, this.velocity.x); + if (this.sprite.debug) + { + console.log('Body preUpdate speed / angle adjust', this.speed, this.angle); + } + } + this.game.physics.checkBounds(this); this.applyFriction(); + + this.integrateVelocity(); + + this.updateBounds(); + + this.checkBlocked(); } + else + { + this.updateBounds(); + } + + +if (this.sprite.debug) +{ + console.log('Body preUpdate AFTER integration x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right); + console.log('Body preUpdate velocity:', this.velocity.x, this.velocity.y); +} + }, - setBlockFlag: function (left, right, up, down, x, y) { + checkBlocked: function () { - this.updateBounds(); - - if (left) + if (this.blocked.left || this.blocked.right && (Math.floor(this.x) !== this.blocked.x || Math.floor(this.y) !== this.blocked.y)) { - this.blockFlags[0] = this.left; - // this.blockFlags[0] = this.left + x; - // console.log('left flag set to', this.blockFlags[0]); - } - else if (right) - { - this.blockFlags[1] = this.right; - // this.blockFlags[1] = this.right + x; - // console.log('right flag set to', this.blockFlags[1]); + console.log('resetBlocked unlocked left + right'); + this.blocked.left = false; + this.blocked.right = false; } - if (up) + if (this.blocked.up || this.blocked.down && (this.x !== this.blocked.x || this.y !== this.blocked.y)) { - this.blockFlags[2] = this.top; - // this.blockFlags[2] = this.top + y; - // this.blockFlags[2] = this.top; - // console.log('up flag set to', this.blockFlags[2]); - } - else if (down) - { - this.blockFlags[3] = this.bottom; - // this.blockFlags[3] = this.bottom + y; - // this.blockFlags[3] = this.bottom; - // console.log('down flag set to', this.blockFlags[3]); + console.log('resetBlocked unlocked up + down'); + this.blocked.up = false; + this.blocked.down = false; } }, @@ -596,8 +582,20 @@ if (this.sprite.debug) this.speed = 0; } - this.velocity.x = Math.cos(this.angle) * this.speed; - this.velocity.y = Math.sin(this.angle) * this.speed; + // Don't bother if speed 0 + if (this.speed > 0) + { + this.velocity.x = Math.cos(this.angle) * this.speed; + this.velocity.y = Math.sin(this.angle) * this.speed; + + this.speed = Math.sqrt(this.velocity.x * this.velocity.x + this.velocity.y * this.velocity.y); + this.angle = Math.atan2(this.velocity.y, this.velocity.x); + } + } + + if (this.sprite.debug) + { + console.log('Body applyFriction velocity:', this.velocity.x, this.velocity.y, 'speed', this.speed); } }, @@ -613,74 +611,116 @@ if (this.sprite.debug) */ reboundCheck: function (x, y, rebound) { + if (this.sprite.debug) + { + console.log('reboundCheck start', this.velocity.x, this.velocity.y); + console.log('reBound blocked state', this.blocked); + } + if (x) { - if (rebound && (this.blocked.left || this.blocked.right)) + if (rebound && this.bounce.x !== 0 && (this.blocked.left || this.blocked.right)) { this.velocity.x *= -this.bounce.x; + this.angle = Math.atan2(this.velocity.y, this.velocity.x); + + if (this.sprite.debug) + { + console.log('X rebound applied'); + } } - var gx = this.getTotalGravityX(); - - if (Math.abs(this.velocity.x) < this.minVelocity.x && (this.blocked.left && gx < 0 || this.blocked.right && gx > 0)) + if (this.bounce.x === 0 || Math.abs(this.velocity.x) < this.minVelocity.x) { - this.velocity.x = 0; + var gx = this.getUpwardForce(); + + if ((this.blocked.left && (gx < 0 || this.velocity.x < 0)) || (this.blocked.right && (gx > 0 || this.velocity.x > 0))) + { + this.velocity.x = 0; + + if (this.sprite.debug) + { + console.log('reboundCheck X zeroed'); + } + } + } + + if (this.sprite.debug) + { + console.log('reboundCheck X', this.velocity.x, 'gravity', gx); } } if (y) { - if (rebound && this.bounce.y && (this.blocked.up || this.blocked.down)) + if (rebound && this.bounce.y !== 0 && (this.blocked.up || this.blocked.down)) { this.velocity.y *= -this.bounce.y; + this.angle = Math.atan2(this.velocity.y, this.velocity.x); + + if (this.sprite.debug) + { + console.log('Y rebound applied'); + } } - var gy = this.getTotalGravityY(); - - if (Math.abs(this.velocity.y) < this.minVelocity.y && (this.blocked.up && gy < 0 || this.blocked.down && gy > 0)) + if (this.bounce.y === 0 || Math.abs(this.velocity.y) < this.minVelocity.y) { - this.velocity.y = 0; + var gy = this.getDownwardForce(); + + if ((this.blocked.up && (gy < 0 || this.velocity.y < 0)) || (this.blocked.down && (gy > 0 || this.velocity.y > 0))) + { + this.velocity.y = 0; + + if (this.sprite.debug) + { + console.log('reboundCheck Y zeroed'); + } + } + } + + if (this.sprite.debug) + { + console.log('reboundCheck Y', this.velocity.y, 'gravity', gy); } } }, /** - * Gets the total gravity to be applied on the X axis. + * Gets the total force being applied on the X axis, including gravity and velocity. * - * @method Phaser.Physics.Arcade#getTotalGravityX - * @protected - * @return {number} The total gravity to be applied on the X axis. + * @method Phaser.Physics.Arcade#getUpwardForce + * @return {number} The total force being applied on the X axis. */ - getTotalGravityX: function () { + getUpwardForce: function () { if (this.allowGravity) { - return this.gravity.x + this.game.physics.gravity.x; + return this.gravity.x + this.game.physics.gravity.x + this.velocity.x; } else { - return this.gravity.x; + return this.gravity.x + this.velocity.x; } }, /** - * Gets the total gravity to be applied on the Y axis. + * Gets the total force being applied on the X axis, including gravity and velocity. * - * @method Phaser.Physics.Arcade#getTotalGravityY - * @protected - * @return {number} The total gravity to be applied on the Y axis. + * @method Phaser.Physics.Arcade#getDownwardForce + * @return {number} The total force being applied on the Y axis. */ - getTotalGravityY: function () { + getDownwardForce: function () { if (this.allowGravity) { - return this.gravity.y + this.game.physics.gravity.y; + return this.gravity.y + this.game.physics.gravity.y + this.velocity.y; } else { - return this.gravity.y; + return this.gravity.y + this.velocity.y; } }, @@ -820,6 +860,8 @@ if (this.sprite.debug) body.velocity.y = nv2; } + // update speed / angle? + }, /** @@ -833,6 +875,9 @@ if (this.sprite.debug) this.velocity.x = body.velocity.x - this.velocity.x * this.bounce.x; this.velocity.y = body.velocity.y - this.velocity.y * this.bounce.y; + + this.angle = Math.atan2(this.velocity.y, this.velocity.x); + this.reboundCheck(true, true, false); }, @@ -1134,6 +1179,11 @@ if (this.sprite.debug) this._dx = this.game.time.physicsElapsed * (this.velocity.x + this._temp.x / 2); this._dy = this.game.time.physicsElapsed * (this.velocity.y + this._temp.y / 2); + if (this.sprite.debug) + { + console.log('integrateVelocity TEMP:', this._temp.x, this._temp.y); + } + // positive = RIGHT / DOWN // negative = LEFT / UP @@ -1141,14 +1191,34 @@ if (this.sprite.debug) { this.x += this._dx; this.velocity.x += this._temp.x; - console.log('x added', this._dx); + if (this.sprite.debug) + { + console.log('integrateVelocity x added', this._dx, this.x); + } + } + else + { + if (this.sprite.debug) + { + console.log('integrateVelocity x failed or zero, blocked left/right', this._dx); + } } if ((this._dy < 0 && !this.blocked.up && !this.touching.up) || (this._dy > 0 && !this.blocked.down && !this.touching.down)) { this.y += this._dy; this.velocity.y += this._temp.y; - console.log('y added', this._dy); + if (this.sprite.debug) + { + console.log('integrateVelocity y added', this._dy, this.y); + } + } + else + { + if (this.sprite.debug) + { + console.log('integrateVelocity y failed or zero, blocked up/down', this._dy); + } } if (this.velocity.x > this.maxVelocity.x) @@ -1183,8 +1253,6 @@ if (this.sprite.debug) { this.reboundCheck(true, true, true); - this.integrateVelocity(); - this.game.physics.checkBounds(this); if (this.deltaX() < 0) @@ -1205,44 +1273,27 @@ if (this.sprite.debug) this.facing = Phaser.DOWN; } - this.updateBounds(); + // this.updateBounds(); if (this.sprite.debug) { - console.log('Body postUpdate x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right); + console.log('Body postUpdate x:', this.x, 'y:', this.y, 'left:', this.left, 'right:', this.right, 'WAS', this.preX, this.preY); + console.log('Body postUpdate blocked:', this.blocked, this.blockFlags); + console.log('Body postUpdate velocity:', this.velocity.x, this.velocity.y); } - // this.sprite.x = this.x + (this.sprite.x - this.sprite.center.x) - this.offset.x; - // this.sprite.y = this.y + (this.sprite.y - this.sprite.center.y) - this.offset.y; - - if (this.sprite.name === 'mushroom') - { - // console.log('old x', this.preX, 'new x', this.x, 'delta', this.deltaX()); - // console.log('old y', this.preY, 'new y', this.y); - } - this.sprite.x = this.x - this.offset.x; this.sprite.y = this.y - this.offset.y; this.sprite.worldTransform[2] = this.x - this.offset.x; this.sprite.worldTransform[5] = this.y - this.offset.y; - - - // this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]); - - - // this.sprite.x = this.x + (this.sprite.world.x - this.game.camera.x) - this.offset.x; - // this.sprite.y = this.y + (this.sprite.world.y - this.game.camera.y) - this.offset.y; - - // this.world.setTo(this.game.camera.x + this.worldTransform[2], this.game.camera.y + this.worldTransform[5]); - - if (this.allowRotation) { // this.sprite.rotation = this.rotation; // this.sprite.angle += this.deltaZ(); // this.sprite.angle = this.angle; } + } }, @@ -1268,6 +1319,7 @@ if (this.sprite.debug) this.mass = 1; this.friction = 0.1; this.checkCollision = { none: false, any: true, up: true, down: true, left: true, right: true }; + this.blocked }, @@ -1410,18 +1462,3 @@ Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "y", { } }); - -/** -* @name Phaser.Physics.Arcade.Body#movingLeft -* @property {number} movingLeft -*/ -Object.defineProperty(Phaser.Physics.Arcade.Body.prototype, "movingLeft", { - - /** - * @method movingLeft - * @return {boolean} - */ - get: function () { - } - -}); diff --git a/src/tilemap/Tile.js b/src/tilemap/Tile.js index bf2a8f49..6acaa287 100644 --- a/src/tilemap/Tile.js +++ b/src/tilemap/Tile.js @@ -131,6 +131,8 @@ Phaser.Tile = function (layer, index, x, y, width, height) { */ this.callbackContext = this; + this.debug = false; + }; Phaser.Tile.prototype = { diff --git a/src/tilemap/TilemapLayer.js b/src/tilemap/TilemapLayer.js index 734a57c2..0431afc7 100644 --- a/src/tilemap/TilemapLayer.js +++ b/src/tilemap/TilemapLayer.js @@ -482,12 +482,16 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides height = this.layer.heightInPixels; } + // console.log('getTiles', x, y, width, height, collides); + // Convert the pixel values into tile coordinates this._tx = this.game.math.snapToFloor(x, this._cw) / this._cw; this._ty = this.game.math.snapToFloor(y, this._ch) / this._ch; this._tw = (this.game.math.snapToCeil(width, this._cw) + this._cw) / this._cw; this._th = (this.game.math.snapToCeil(height, this._ch) + this._ch) / this._ch; + // console.log('getTiles snapped', this._tx, this._ty, this._tw, this._th); + // This should apply the layer x/y here this._results.length = 0; @@ -526,6 +530,8 @@ Phaser.TilemapLayer.prototype.getTiles = function (x, y, width, height, collides } } + // console.log('getTiles results', this._results); + return this._results; } @@ -708,15 +714,15 @@ Phaser.TilemapLayer.prototype.updateMax = function () { */ Phaser.TilemapLayer.prototype.render = function () { - if (this.layer.dirty) - { - this.dirty = true; - } + // if (this.layer.dirty) + // { + // this.dirty = true; + // } - if (!this.dirty || !this.visible) - { - return; - } + // if (!this.dirty || !this.visible) + // { + // return; + // } this._prevX = this._dx; this._prevY = this._dy; @@ -790,6 +796,12 @@ Phaser.TilemapLayer.prototype.render = function () { this.map.tileHeight ); } + + if (tile.debug) + { + this.context.fillStyle = 'rgba(0,255,0,0.5)'; + this.context.fillRect(Math.floor(this._tx), Math.floor(this._ty), this.map.tileWidth, this.map.tileHeight); + } } else { diff --git a/src/utils/Debug.js b/src/utils/Debug.js index 61651e99..09a0d4c9 100644 --- a/src/utils/Debug.js +++ b/src/utils/Debug.js @@ -640,9 +640,10 @@ Phaser.Utils.Debug.prototype = { color = color || 'rgb(255, 255, 255)'; this.start(0, 0, color); + this.context.lineWidth = 1; this.context.beginPath(); - this.context.moveTo(line.start.x, line.start.y); - this.context.lineTo(line.end.x, line.end.y); + this.context.moveTo(line.start.x + 0.5, line.start.y + 0.5); + this.context.lineTo(line.end.x + 0.5, line.end.y + 0.5); this.context.closePath(); this.context.stroke(); this.stop();