Ok so my platformer is coming along nicely and a lot quicker than I thought
When my hero hits a Box2D object I am using Event.PRE_SOLVE to detect and stop the world from moving, change hero animation etc. If he then turns around to move off the object can I detect this with built in functions or do I need to maintain some variables myself to achieve this functionality? I am currently using variables but it is getting messy, hence the question.
NOTE: the world only moves when the hero is set to move left/right/up/down, it is not a continuous runner.
Thanks,
Comments
Additionally you can retrieve and save specific contact informations, like:
Use the left/right arrows to move the map.
The moving object stops when it collides with another body, but (once box turns grey) you can then pass through that body unlimited times until you hit a different body.
Also note that if you change the mover objects start position x to 150 it drops onto the body but then stays at that height until it hits another body before it falls to the ground. I realise I am not moving the map in the y-axis but I never am (in this project) and it still falls after hitting another body.
If I hook PRE_SOLVE, POST_SOLVE, BEGIN_CONTACT, END_CONTACT, once the initial contact is made, none of these events are fired until contact is made with a different body.
Any ideas?
Thanks
Will take a closer look when I get back in.
you can't move character like this, nor you can move map like this, it can break box2d world calculations, and thus break collisions, etc.
you would need to move your character with applyForce, jump with applyLinearImpulse and let scene follow the character, by getting its coordinates on each enter frame and move the scene
Here is how I would go about it:
Likes: chipster123