Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075922 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:45:45 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)Mega Man jump
Pages: [1]
Print
Author Topic: Mega Man jump  (Read 2022 times)
theman515
Level 0
**


The code... the code!!


View Profile WWW Email
« on: November 13, 2011, 02:51:05 PM »

Hey guys, so about a month ago I was working on a jump mechanic for a side-scrolling shooter and I used realistic physics equations (Y=V1t+1/2At^2) and the result is, of course, a parabolic arc but it feels unnatural and slow. I asked my friend who played the game if it feels ok and she said it felt fine but I still had my reservations.

Fast-forward to today. I was re-playing my Mega Man X game for the Super Nintendo and realized the jump in the Mega Man series (from classic to X1, I haven't played any further) was exactly what i was looking for. does anyone know how they did it? what equation they used? etc.

TL;DR I played Mega Man x and want to know how they made Mega Man jump like he did.

Thanks in advanced!  Gentleman
Logged
noah!
Level 6
*


View Profile
« Reply #1 on: November 13, 2011, 03:13:39 PM »

It's a parabolic curve, but it works a little differently than you'd expect. Basically, when Mega Man jumps, his vertical speed is set to a number (roughly 4.875). This number controls how many pixels Mega Man travels up the screen. However, this number decreases by 0.25 every frame (at 60 frames per second). Eventually, over the course of so many frames, the number hits 0 and starts going into the negatives (he's falling). Finally, the terminal velocity is set at -12, so the counter stops once Mega Man is falling faster than that value.

For more information please visit this TASVideos page. It has all the information you should need, including even the subtle physics changes between games. There's even one for Mega Man X too!

Now you know, and knowing is half the battle! Good luck!

(also, keep in mind that this method will only work if your game has a fixed-timestep!)
Logged
rivon
Level 10
*****



View Profile
« Reply #2 on: November 13, 2011, 03:24:08 PM »

In variablestep you would do it like this:
(pseudocode):
Code:
yspeed = 4.875;

while (true)
{
    yspeed -= 15 * delta_time_in_sec;
    if (yspeed < -12)
        yspeed = -12;
}
Logged
theman515
Level 0
**


The code... the code!!


View Profile WWW Email
« Reply #3 on: November 13, 2011, 03:35:57 PM »

Thanks guys, this was exactly what i was looking for.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic