How to do a charged up jump mechanic (think Spring Ninja)

Just started using Construct 2? Post your questions here

Post » Tue Mar 24, 2015 9:12 pm

Spring Ninja's spring mechanics is perhaps the best way to describe what I am aiming for. So, depending on how long a button is held down for, upon release, the object jumps at a certain angle to cover a certain amount of distance. So, a simple tap would just make the object hop slightly to the side (almost like a sidestep) whereas holding down for a second would charge up for a medium jump and any longer would charge up a larger leap. Again, the input only charges the jump. The actual jump action does not activate until the player has released the input. I was looking into Platform behaviour for this but now I'm thinking maybe Bullet behaviour would be more fitting (angle of motion and all).
B
8
S
2
G
1
Posts: 34
Reputation: 623

Post » Wed Mar 25, 2015 4:29 am

Ok, I have an idea I'm going to try out but I'm stuck on one thing.

Basically, I set a global variable known as Charge and have it where if the "C" key is held down a 1 is added to Charge every 0.2 seconds. The max for that charge will be 7, which would be reached in 1.4 seconds (I may change these timings depending on what feels good in terms of mechanics). Then, when "C" key is released, whatever value the Charge variable was at will be stored. What I do then is use that value to determine the length of the jump. So, if the value was between 0 and 1, a short hop to the right will be executed (x angle of motion). If over 1 but under 2, a slightly lengthier jump to the right is executed. And so on, with over 2 but under 3, etc, etc.

Does that look good? If so, and this is where I'm stuck, how do I store the value of a global variable when the key is released?
B
8
S
2
G
1
Posts: 34
Reputation: 623

Post » Wed Mar 25, 2015 6:03 pm

Ok, I've attempted the above and it seems to work. What I'm stuck on now is making sure the motion of the object after it has jumped ends instantly when the object comes into contact with the ground again. Right now, the object is sliding (I'm using physics behaviour). I need to make sure that each of the seven jumps (activated depending on how long the key is held for) covers the same distance if repeated. Can anyone help?

Just another thing to ask, would physics behaviour be apt for this? If I want the exact same distance covered if the player repeats jump #3 (hold button for half a second) then is there another behaviour that would give me that exactness?
B
8
S
2
G
1
Posts: 34
Reputation: 623

Post » Wed Apr 08, 2015 10:45 am

have you tried it works, dude?

I need help on that too.
B
42
S
4
G
2
Posts: 24
Reputation: 2,102

Post » Wed Apr 08, 2015 3:00 pm

Oh hello!

Yes. It is not the most elegant of solutions but it does indeed work. Give me a sec, I will post it.
B
8
S
2
G
1
Posts: 34
Reputation: 623

Post » Wed Apr 08, 2015 3:35 pm

Message: GDSag3 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Now, change the values to get the sort of jump you like (in height or length) and how long it takes to charge, etc.

http://postimg.org/image/ot02u68z7/full/
B
8
S
2
G
1
Posts: 34
Reputation: 623

Post » Wed Apr 08, 2015 8:15 pm

thank you!!! I will try it~
B
42
S
4
G
2
Posts: 24
Reputation: 2,102

Post » Fri Apr 10, 2015 2:09 am

just tried it recently, and it's great dude!!!
thank you very much! :)
B
42
S
4
G
2
Posts: 24
Reputation: 2,102


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests