Doing this causes quite a few issues.
Firstly, the world is locked and can’t change anything with addBody while ‘number crunching’
To solve this I put the physics change on a small timer using timer.performWithDelay(1,waitphysics)
And it sort of worked, But very badly.
My player was sinking halfway into the floor then juttering around and sometimes he’s pop out the side.
It was pretty bad.
I’m kind of just thinking of a platformer where you can jump up and down layers of floor y’know.
I found a great website which goes through the ideas behind different platformers.
The kind I’m wondering about is the ‘One-Way Platformers’
It’s pretty decent at summarizing the requirements.
http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/
**"One-way platforms are platforms that you can step on, but you can also jump through them. In other words, they count as an obstacle if you’re already on top of them, but are otherwise traversable. That sentence is the key to understanding their behavior. The algorithm changes as follows:
On the x axis, the tile is never an obstacle
On the y axis, the tile is only an obstacle if, prior to the movement, the player was entirely above it (that is, bottom-most coordinate of player was at least one pixel above top-most coordinate of one-way platform). To check for this, you will probably want to store the original player position before doing any stepping.
It might be tempting to have it act as an obstacle if the player’s y speed is positive (that is, if the player is falling), but this behavior is wrong: it’s possible for the player to jump so he overlaps the platform, but then falls down again without having his feet reach the platform. In that case, he should still fall through."**
[import]uid: 91798 topic_id: 29640 reply_id: 118985[/import]