This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 13 Nov 2003 04:41:45 pm    Post subject:

In the side scrollers like Mario, how do you get the guy to jump and make him fall down again in z80? I know how to move it right and left, but not up and down.
I don't need any source code, just the concepts and ideas needed to construct the code.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 13 Nov 2003 05:21:29 pm    Post subject:

You mean how to find the coordinates at a given time, not how to display the sprite? I believe it's quadratic.
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 13 Nov 2003 06:29:20 pm    Post subject:

Both and whats quadratic? We haven't got that far in school. (Schools in North America stink in math compared to China. In grade 10 BTW)
Back to top
interwined


Newbie


Joined: 26 Sep 2003
Posts: 39

Posted: 13 Nov 2003 07:01:53 pm    Post subject:

Information about the quadratic formula can be found http://mathworld.wolfram.com/QuadraticEquation.html. We learned about that in seventh grade and I live in Ohio.
Back to top
JacobdeHaan


Member


Joined: 10 Jul 2003
Posts: 165

Posted: 13 Nov 2003 07:40:20 pm    Post subject:

Sir Robin's idea would probably work the best.
A negative quadratic function will give you the sort of shape you would like for the jump (if you want to see this, just type in -xx in y= and press graph)
So you would just plug in the x coordinate to get your y coordinate and you've got your sprite's location.
BTW, what math are you in?
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 13 Nov 2003 07:54:58 pm    Post subject:

Quadratic equations are usefull for plotting paths for falling objects (such as a jumping plumber or a leaping hedgehog). The purpose here is to avoid those unnatural-looking jumps where your character leaps up at a constant speed, and then immidiately falls down at the same constant speed.

Instead, as your character jumps, his upward speed should slow until he reaches a peak height. Then naturally, 'gravity' pulls him downward in a similar fashion--causing him to fall faster and faster until he hits the ground again.

Whenever gravity is involved you'd use the quadratic:


Code:
Height= -(1/2)(Gravity Strength)(Time)^2 + (Speed of Jump)(Time) + (Starting Height)


...This makes your character jump in a more life-like arc. Bill Nagels's and Sam Heald's Mario games seem to use this technique.


Last edited by Guest on 13 Nov 2003 08:02:29 pm; edited 1 time in total
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 13 Nov 2003 11:56:02 pm    Post subject:

learned quadratic formula in 7th grade. i live in texas.
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 13 Nov 2003 11:57:45 pm    Post subject:

I think that is the normal time to learn it. Am I wrong?
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 14 Nov 2003 01:53:56 am    Post subject:

Yeah, we studied quadratics in 7th grade in Austin, Tx. I think they called them "polynomials" at the time (while learning "F.O.I.L." and such). Although, I didn't ever use the gravity formula until we decided to build a potato launcher in high school.
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 14 Nov 2003 03:30:58 pm    Post subject:

JacobdeHaan
I am in Canada, Ontario. They have not taught quadratics yet. They teach it in grade 10, like some time in January. I am currently in grade 10.
Man U.S. math is awesome compared to Canadian. Stupid education board!! Mad
In canada they first introduce polynomials in grade 7 and 8.
ex :
simplify 2x+4x=6x
In grade 9 thats when they teach factoring and the such
ex:
simplify (a+ B ) (a+ B ) = a^2+2ab+b^2


Last edited by Guest on 14 Nov 2003 03:31:32 pm; edited 1 time in total
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 14 Nov 2003 03:58:13 pm    Post subject:

I learned quadratics in 7th grade but I've been trying hard to get ahead in math so I am at the same level as my friends in Russia (some of my friends are now learning them in 10th grade). I am currently in 9th grade in North Carolina.

Aren't quadratics first taught in the 2nd part of Algebra 1?
Back to top
JacobdeHaan


Member


Joined: 10 Jul 2003
Posts: 165

Posted: 14 Nov 2003 06:26:55 pm    Post subject:

Quadratics are a major part of all of Algebra 1 because it is all about factoring and multiplying polynomials, and using the Quadratic formula.

Last edited by Guest on 14 Nov 2003 06:27:08 pm; edited 1 time in total
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 14 Nov 2003 06:49:47 pm    Post subject:

Well anyways, you'd want to try a quadratic to get more natural, more true-to-life motion. Though, most TIs have so little picture resolution, an actual quadratic may be overdoing it. You could try streamlineing the process by having the having the character's speed decrease maybe mid-way through the jump. The main thing is to avoid letting the character rise and fall at constant speeds.
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 14 Nov 2003 07:42:37 pm    Post subject:

If I just wanted the character to fall, like if it walked off a small ledge, would i also use quadratics?
Back to top
sgm


Calc Guru


Joined: 04 Sep 2003
Posts: 1265

Posted: 14 Nov 2003 08:36:22 pm    Post subject:

I think a very rough method that should give okay results would go like:

  • When the player jumps, give him a starting "force" (number of pixels to go up)
  • Add his current jump force to his y-position
  • Each frame, subtract from his jump force some constant value (force of gravity)
  • Check for hitting his head or landing on a platform
When the force becomes negative, probably should implement a terminal velocity (maximum number of pixels he can fall in one frame).


Last edited by Guest on 14 Nov 2003 08:36:58 pm; edited 1 time in total
Back to top
JacobdeHaan


Member


Joined: 10 Jul 2003
Posts: 165

Posted: 15 Nov 2003 01:49:53 am    Post subject:

Another thing to factor in when you are making a side scroller is that in many of them, they allow you to move while falling, so really only your Y coordinates should be controlled by it, leaving the X vars in the control of the user.
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 15 Nov 2003 05:01:46 pm    Post subject:

well currently I have an aligned sprite routine, how would you create smooth scrolling?
And which one should I attempt to make first, smooth scrolling or jumping?
Back to top
MaxVT103


Member


Joined: 24 Aug 2003
Posts: 109

Posted: 15 Nov 2003 10:18:29 pm    Post subject:

I would definately try to get the smooth scrolling bc that will probobly be one of the most difficult thing you will do. Everything will most likely build off of it.
Back to top
DigiTan
Unregistered HyperCam 2


Super Elite (Last Title)


Joined: 10 Nov 2003
Posts: 4468

Posted: 15 Nov 2003 10:58:42 pm    Post subject:

Quote:
well currently I have an aligned sprite routine, how would you create smooth scrolling?
And which one should I attempt to make first, smooth scrolling or jumping?


I would definately go with smooth scrolling first. The only trouble would be developing high-speed map drawing code. Luckily, CrASH_Man managed to publish a very fast (106 fps max) routine called Tilemap v3.0 back in 2001 for TI-82 and 83.

The priciples behind smooth scrolling are identical to the ones you'd use for aligned scrolling, execept that you now have the option of scrolling 1 pixel at a time using "offsets". For Tilemap, you'd use these variables as offsets:

"ssx" = for tile-by-tile scrolling (this holds values between 0 and 255)
"ssy" = same as ssx, but for verticle scrolling
"sox" = for pixel-by-pixel scrolling (this holds values between 0 and 7)
"soy" = same as sox, but for verticle scrolling

So for example, a "0" in all four of these values would show the upper-leftmost part of your map. If you suddenly increased "ssx" to "1", your map would shift left 1 whole tile. Then, if you suddenly increased "sox" to "1", your map would shift left 1 pixel, an so on..
Back to top
omni


Member


Joined: 14 Jun 2003
Posts: 115

Posted: 16 Nov 2003 08:59:08 am    Post subject:

ah alright, but if my game is just a side scroller I wouldn't need the vertical stuff right?
Digitan could you explain how you got those numbers?


Last edited by Guest on 16 Nov 2003 01:27:48 pm; edited 1 time in total
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page 1, 2  Next
» View previous topic :: View next topic  
Page 1 of 2 » All times are UTC - 5 Hours

 

Advertisement