How do I program Yoshi's "flutter jump"

Get help using Construct 2

Post » Wed Oct 08, 2014 11:28 am

Message: SoupeDuJour is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I'm having trouble programming a bug-free version of Yoshi's "flutter jump". I read a previous "how do I..." post on this subject and it helped me a lot in getting to the stage I'm at, but now I'm stuck. Here is a link of how it should look: I've attached a capx of (a version of) the current code that is causing me problems.

When you first run the capx and hold down the jump button, the player acts as close to how I would like it to. The problems are with the sine wave behaviour and the y vector. The first problem is that on every subsequent jump the players y position changes sharply to an unexpected position in midair.

The second problem is that if you release the jump button during the flutter jump phase, the sine wave does not reset to the beginning of the phase as I would expect it to with the action "set sine cycle position to 0".

The action of "wait 1.3 seconds" is to enable the flutter jump animation to end (and for the player to begin falling) towards the top of the sine wave peak, with the Period set at 2 (as it does during the first instance).

I have some prior knowledge of programming (particularly in C++/C# and Java) and I know the maths behind sine wave behaviours, but I am very inexperienced when it comes to Construct 2. I have read the manual and tried looking for other posts with regards to sine waves and similar problems but have found nothing of use. Any help or advice would be much appreciated!
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 2
Reputation: 204

Post » Wed Oct 08, 2014 11:49 am

The sinewave behavior has no place in this mechanic. The solution is actually very simple...

+Player is NOT on floor
+Jump button is being pressed
-Subtract 60*dt from Player.FlutterJump

+Player.FlutterJump < 0
+Player.FlutterJump > -60
-Set Player Y Velocity to Self.Platform.VectorY - Self.FlutterJump

...It will probably need some tweaking but you get the idea. It's a simple counter force upwards.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Wed Oct 08, 2014 1:25 pm

Thank you so much! I have already ditched the sine behaviour and I'm doing my best to incorporate your instructions. =D
B
4
Posts: 2
Reputation: 204


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 51 guests