A simple jumping problem.

Get help using Construct 2

Post » Sun Feb 16, 2014 4:02 am


I'm creating a custom movement system for a platforming character.
This is the Jumping.

The problem is that when I hold down the space bar, the Player rises into the air, not falling until the spacebar is released.

What I want to happen is for the player to do one jump per each press of the spacebar, no matter how long it is held down.

I can't see why it doesn't do that with this piece of code...
When the spacebar is pressed it sets Jumping to true, which should prevent the velocity from increasing until the spacebar is released and jumping is set to false again. But it doesn't do that. The player just keeps on rising into the air.

Pls help.

B
5
Posts: 85
Reputation: 395

Post » Sun Feb 16, 2014 4:18 am

Use Space pressed instead of Space is down.

B
10
S
2
Posts: 135
Reputation: 1,090

Post » Sun Feb 16, 2014 4:31 am

That was my thought too, but it doesn't make any difference. I can find no difference between the two functions.
B
5
Posts: 85
Reputation: 395

Post » Sun Feb 16, 2014 8:12 am

Try putting your other conditions together with the condition on space key is pressed instead of using them as a sub condition.
B
42
S
20
G
31
Posts: 685
Reputation: 20,221

Post » Sun Feb 16, 2014 6:06 pm

[QUOTE=rekjl] Try putting your other conditions together with the condition on space key is pressed instead of using them as a sub condition.[/QUOTE]

Thanks, but sadly this makes no difference to anything at all.

B
5
Posts: 85
Reputation: 395

Post » Sun Feb 16, 2014 6:15 pm

You are over thinking your custom jumping. Your desired effect can be achieved in two or three events.
B
56
S
15
G
13
Posts: 825
Reputation: 17,643

Post » Sun Feb 16, 2014 6:29 pm

[QUOTE=Tekniko] You are over thinking your custom jumping. Your desired effect can be achieved in two or three events.[/QUOTE]

The reason I have set it up like this is so that the attributes of the jump can be modified as the player collects powerups.

However if you've got an easier way, please, tell me more!
B
5
Posts: 85
Reputation: 395

Post » Mon Feb 17, 2014 1:32 am

Try changing from (on key pressed) back to (space is down), but now add a (trigger once) condition together with them.
B
42
S
20
G
31
Posts: 685
Reputation: 20,221

Post » Mon Feb 17, 2014 6:23 am

[QUOTE=rekjl] Try changing from (on key pressed) back to (space is down), but now add a (trigger once) condition together with them. [/QUOTE]

Already tried that I'm afraid to say, it also makes no difference at all.
B
5
Posts: 85
Reputation: 395

Post » Mon Feb 17, 2014 2:19 pm

Make a boolean switch to activate the event only once.
Setup a flag and add a check for it together with your Space is pressed/ Space is down event, then activate the flag inside this event. Then when your player touches the ground reactivate the flag.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests