How do I do platformer game with only physics

0 favourites
  • 6 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • I am trying to do a game that has physics and you play with a character that needs to push and avoid getting killed by physics objects. Character is controlled by buttons that will apply some physic forces to left or right, or up (jump)

    The problems:

    How do I detect when the character is again back on ground after jump, so i can prevent him jumping (flying) with the physics before he is back?

    I need something like "if character is colliding with another physics object, enable jump, else disable it".

    And then: "if character is moving after jump to direction y at any speed, enable double jump. else disable it."

    Now i have done it with timer. Character can jump only once / 1 second, but its not best solution to this. And because every force has an equal opposite force, i made it like when player clicks jump button, my character first does physics force 300 to angle 90, then waits 0,1 second and does physics force 300 to angle -90. This works very well, except when he is in air when player clicks the jump button. Then the character fast moves down, that is not good thing.

    I hope someone understood what i am trying to do.

  • You can check the angular velocity of your character. When he is jumping up it will be a negative number, when falling a positive number and when stood still it will be zero.

    Another method would be to put a dummy object just above the ground and check to see if he is overlapping it. If he is then he can jump else he cant.

  • Thank you a lot about taking time to help me. When i get home, i will test that velocity thingy.

    Dummy object is also very clever, but i think it would not work, because there is also physic objects that would also need their own dummy objects and it would be little overkill.

  • Oh, i forget to mention another problem:

    I need to use really big physic forces to prevent the character getting stuck into the other objects. That is good in some cases, but when he "runs" against some obstacle, he actually can stay in the air, because the physic is pushing him against of the obstacle and prevents the gravity get him down. What should i do with that? Add some timer to the "run" button, or is there any way to slowly fade the physic force out if he keeps pressing the button, so he falls down slowly?

  • You can put anything your character needs to interact with in a family, that way if he interacts with anything in that family you can set actions.

    I would imagine you would be better applying physics impulse rather than a constant force in any direction. Check out the manual to see the differences.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, i need to buy the full version, because this free one does not support families. But thanks again for help.

    I also discovered health bar and i think developing games with construct is actually very funny ! (y)

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