lewster32 / phaser-plugin-isometric

Feature-packed axonometric plugin for Phaser 2 which stays true to the Phaser API.
http://rotates.org/phaser/iso
MIT License
472 stars 165 forks source link

Static bodies #36

Closed rafaelmembrives closed 8 years ago

rafaelmembrives commented 8 years ago

I want to create a player isoSprite that can jump over static isoSprites but the body.static property is undefined.

I have tried with body.immovable=true but this cause a strange behaviour. The player can´t push the blocks but when it jumps over one of thems it pull from it when increase o decrease the body.velocity.y. It´s very ease to replicate, take the "Basic character movement" example and add that after line 54:

cube.body.immovable=true;

Then jump over some cube and pres up or down cursor keys.

Thanks in advance

wassname commented 8 years ago

I can confirm this. I added the line, making the blocks immovable. Then I jumped on one and moved in the y direction (pressing up/down) which caused the block to move along with me. No problem in the y direction.

lewster32 commented 8 years ago

Well spotted - seems to have been a typo in the platform special case code in separateZ.

rafaelmembrives commented 8 years ago

Now it works perfectly, thank you so much!

I´m using body.immovable = true and body.allowGravity = false to make static platforms like these ones in this 2D example:

http://phaser.io/examples/v2/p2-physics/static-body

I wonder if there´s a better way to do that...

lewster32 commented 8 years ago

I think your way is the 'accepted' way to do it with Arcade/IsoArcade physics. I've created examples a while back for implementations in the standard 2D Arcade physics which should work basically the same in 3D IsoArcade. If you do spot any inconsistencies however, please do let me know and I'll see what I can do.