How do I make my player jump WITHOUT the platform behavior?

Just started using Construct 2? Post your questions here

Post » Sun May 01, 2016 7:46 pm

I'm trying to make my player jump using the Physics behavior instead of the Platform behavior because applying that behavior to the character doesn't allow my game to function how it's supposed to. I made it so that every time you press the space bar, it launches the player up, but this allows the player to have infinite jumps, any way to fix this so that they can't fly? Thanks!
Image
B
10
S
1
Posts: 6
Reputation: 464

Post » Sun May 01, 2016 7:56 pm

You can give the player an instance variable, such as a boolean that is either true or false. Call it something like onFloor.
If you press spacebar, set it false. If player collides with floor, set to true. If player walks off floor without jumping, set it false. You'd also check to see if onFloor is true to determine whether to allow player to jump. You'd also need to implement some events to check whether player overlaps with floor, so that you can set variable true or false.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Sun May 01, 2016 8:19 pm

Prominent wrote:You can give the player an instance variable, such as a boolean that is either true or false. Call it something like onFloor.
If you press spacebar, set it false. If player collides with floor, set to true. If player walks off floor without jumping, set it false. You'd also check to see if onFloor is true to determine whether to allow player to jump. You'd also need to implement some events to check whether player overlaps with floor, so that you can set variable true or false.

Thanks so much! It worked perfectly.
B
10
S
1
Posts: 6
Reputation: 464


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests