How do I do platformer game with only physics

Get help using Construct 2

Post » Mon Mar 30, 2015 10:09 pm

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.
B
11
Posts: 63
Reputation: 508

Post » Tue Mar 31, 2015 7:35 am

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.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Tue Mar 31, 2015 9:42 am

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.
B
11
Posts: 63
Reputation: 508

Post » Tue Mar 31, 2015 10:09 am

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?
B
11
Posts: 63
Reputation: 508

Post » Tue Mar 31, 2015 11:24 am

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.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Thu Apr 02, 2015 5:59 pm

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)
B
11
Posts: 63
Reputation: 508


Return to How do I....?

Who is online

Users browsing this forum: bigcatrik, Exabot [Bot], newt, thatserafimkid and 4 guests