Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / How to implement a "jump" function...

Author
Message
Dextro
21
Years of Service
User Offline
Joined: 26th Feb 2005
Location:
Posted: 4th May 2006 18:25
Ala Mario bros. 1 for the nes?
The end is near
21
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 5th May 2006 01:30
WhAt?!?!

stargate sg-1 the one show that never gets old

Freddy 007
21
Years of Service
User Offline
Joined: 30th Nov 2004
Location: Denmark
Posted: 7th May 2006 22:10
I think zenassem was doing a 2d tutorial, I'm sure that is going to cover this.

zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 8th May 2006 01:57 Edited at: 8th May 2006 02:08
Yeah it will be covered. I'm just tweaking the numbers now, and I'm about to add some enemies and A.I.

The jumping in Super Mario Bro.'s is a little more complex than one might first think. I think that I have gotten pretty close to the orignal. I'm still running some comparisons. If you'd like I can post the code for just the jumping/and drift section in a day or so. I would post it now, but somewhere in my input handler I'm not correctly counting the players position when running right and left. So I'm just trying to figure out where I the problem is.

ahhh what the heck. Here's the code. Mind you there it contains a problem in the move code above. and I don't have the sound implemented. Some of the code will change when I release the tutorial, so keep an eye out for it.

This is the input handler subroutine that get's called from the main loop every loop cycle


These subroutines are called from the input handler. It set's all the values for the jumping code below, and handles all other movement as well



This is the code in the main loop that actually performs the jump


As is, I haven't yet added the accounted for the slow down drift/skid in updating my the characters grid position.
Dextro
21
Years of Service
User Offline
Joined: 26th Feb 2005
Location:
Posted: 8th May 2006 06:56
I was thinking along the lines of a sin jump, to calculate the angle on which mario would be heading.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 8th May 2006 14:59
Yeah, I tried doing that but I didn't get it right. Afterwards, I found a SIN jump implementation in the code. Just search for jump.

Login to post a reply

Server time is: 2026-07-04 11:45:43
Your offset time is: 2026-07-04 11:45:43