How do I Jump and Hold to Glide?

Just started using Construct 2? Post your questions here

Post » Tue May 30, 2017 4:29 pm

Hi, I'm pretty new to Construct 2 and I am making a game where my character has wings and can glide. I need to be able to press the up button to jump, but if I hold it down the character glides for a few seconds until it lands on a platform/ground or collides with a trap and dies.

How would I program the up button, preferably using the platform behavior (which is already implemented on my player), and what do I do to simulate a gliding motion? Thanks.
B
4
S
1
Posts: 2
Reputation: 304

Post » Tue May 30, 2017 5:25 pm

The platform behavior has a gravity setting. I would probably just do
on up press, is falling: change animation to glide, set gravity to some lower value.
On landed: set gavity to normal
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Wed May 31, 2017 12:03 am

Alright I have tried that but whenever I simply quickly press the up arrow button (which is supposed to make the player jump), the player simulates a glide instead, jumping higher than it is supposed to and gliding down.

How do I make it so that the gravity change only occurs when I hold down the up arrow, not whenever I press it?
B
4
S
1
Posts: 2
Reputation: 304

Post » Wed May 31, 2017 12:22 am

I suppose you could make an instance variable that increase while the up button is down. Change the gravity when the number is high enough. Then reset that value on key release.
B
25
S
16
G
26
Posts: 125
Reputation: 16,103


Return to Beginner's Questions

Who is online

Users browsing this forum: Jetzoo1 and 0 guests