zxxz Posted March 7, 2014 Share Posted March 7, 2014 Hello, I have created a platform game where the main character can run in front of crates and then jump up to land on top of them as seen in Mario etc. I have tried setting the relevant tiles to only collide on the top face, however this leads to the main character getting sucked up on top of the crate whenever any part of his body collides with the top of the crate. So if you are stood in front of the crate, jump, half of the body goes through the top of the crate as expected before the sprite is pushed on top of the crate. I have tried a few ways of getting around this such as changing the collision of the crate tiles, judging on whether the bottom of the sprite is above the crate but have not managed to get this working. Any help would be appreciated, cheers! Link to comment Share on other sites More sharing options...
Heppell08 Posted March 7, 2014 Share Posted March 7, 2014 You should set the collision as full, then set the body to never be blocked up so you can go through the bottom of the block but never down through the block. If that makes sense to you anyway Link to comment Share on other sites More sharing options...
zxxz Posted March 8, 2014 Author Share Posted March 8, 2014 Thank you, do you know how that may be possible? Looking at the docs I can't see how to do this? Thanks! Link to comment Share on other sites More sharing options...
Heppell08 Posted March 8, 2014 Share Posted March 8, 2014 There is:body.blocked.up = false;That means that it will be set to false and you can pass under. Place it in update so its constantly reminded that you can pass through. I've seen that example used somewhere but can't remember the link.Just set the collision as standard on the blocks.map.setCollisionBetween(1,10); //egHope this is helpful Link to comment Share on other sites More sharing options...
Recommended Posts