I'm on the lookout for a good implementation of pushing. I've set up my entities with the right push values, and set enable_push for my player, but I'm having trouble getting the player to move (smoothly) out of the way of the pushing object.
I've tried setting the players external forces using the pushing objects forces, but the problem is that he's already stuck in the object, so he doesn't move as far as he should. I know I could move him within the event function and ignore_you, but this seems kind of a hack rather than real pushing. Another problem is when the player is hit by a (map) entity that is rotating. The other entity isn't 'moving' so no collision is detected.
My ideal push routine would do this:
1. determine which direction the player should be pushed. This is related to the normal of the polygon that collided with the player, and also the direction the pusher is moving.
2. apply some kind of force to the players external forces so that he moves just enough out of the way to be outside the pusher, but not too far that the movement is jumpy (ie player gets pushed, then it takes some time for the object to hit him again and push him some more). If the player is in front of a constant speed moving block, he should be pushed along at a constant speed.
3. player moves (within his own action, not the event function) out of the way. He doesn't get stuck halfway and then start floating up the other entity like my push function does now.
4. really cool would be for the player to get crushed if he is being pushed into a wall or another map entity
Any ideas/suggestions?
Thanks in advance