0 Favourites

Physics Platformer Demo

This forum is currently in read-only mode.
  • 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:

    http://projectbrimstone.googlepages.com/kickit.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?

  • Hmm, the physics movement assumes all hotspots are centred. So it's probably a good idea to centre the hotspot for all objects with physics.

  • That is a great demo

    The physics engine sure has some potential.

    If it was being used for a super mario type 2d platformer, is is possible to stop the player from bouncing as they land?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • That is a great demo

    The physics engine sure has some potential.

    If it was being used for a super mario type 2d platformer, is is possible to stop the player from bouncing as they land?

    Hey, thanks

    As for the bouncyness, I'll see what I can come up with.

  • It sounds good and I want to try it, but when I tried to open it, I got the following error:

    "Microsoft Visual C++ Runtime Library"

    "Runtime error!

    Program: C:\Program Files\Construct\Construct.exe

    The program has requested that the program be terminated in an unusual way.

    Please contact the application's support team for more information."

  • That's strange. I don't know what would cause that. It's still opening fine for me.

  • That's strange. I don't know what would cause that. It's still opening fine for me.

    I checked your sample and it is really nice. One thing though that I couldn't figure out. How on earth do you do ground solid without the solid checkbox?

    I couldn't find anything in the event tab.

    Sincerely

    Andla

  • The physics movement has it's own solidity. Check it out under the movements properties, you'll see a setting for "Collision mask." You can currently set it to bounding box or ellipse.

  • Awesome engine! Shows of capabilities of Construct.

  • That's really nice!

    I played around a bit and tried making dominos. Worked very well.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)