I whipped up a small demo of how someone might make a platfomer that uses physics instead of manually updating the XY coordinates of sprites.
You can jump off of platforms and objects with the Z key, and kick objects around with the X key.
The custom movement was actually pretty easy to make. No need to check if the sprite is intersecting with the ground, and run loops to push him out, because collisions and gravity are automatic with Construct's physics.
Here's the .cap:
It's heavily commented and should be pretty easy to follow.
Some other notes:
- Be sure to check out the player and kick sprites to see how the image points and hotspots are set up.
- The player sprite has two private variables set up, "direction," and "kickTimer," both of which are used to control the kicking action.
- The Gravity, Mass, and Angular and Linear Dampening for objects have been changed from the default settings to get a more "platformer" feel.
- There is a minor bug where the objects sometimes stop responding to collisions with the kicking sprite. I believe that this is because I haven't specified which individual object should be colliding. You could probably make a loop during the kick routine to check for collision with specific objects, and that would take care of it, but I'm lazy so who cares.
Some general tips I picked up while working with the Physics movement:
- Objects rotate according to their hotspot placement.
- The bounding box is also set according to the hotspot placement! WTF?!?
- If you want perfect rotation and collision between objects, make them an odd number of pixels high and wide, so you can set the hotspot directly in the center of the object.
- Use "Ellipse" for the collision mask on round objects. Duh.
Comments? Suggestions? Ideas?