GP32 paths for sprites...


RTj

Member
Joined
Mar 17, 2003
Messages
104
Age
52
You know how you see those old fashioned 'bobs' moving along nice smooth, rounded, paths...

Whats the best way to do a path like that??
Calculate it real-time (big ol' maths)? Or pre-calculate it (tons of x,y co-ords)??

Either way, how the hell do i make a nice rounded path???
Whats the maths behind it?

Is there maybe a prog on the PC that can motion capture the mouse movements? Then i could 'draw' a nice path, have it loop, and the prog could spit me out some co-ords ???
(or is this just wishful thinking... ?)
 
sin/cos..
lots of them..:D

You probably want to have a sin/cos table though.
you could also make a PC program where you can generate your paths and dump a shitload of x,y coords..

Or you could use somekind of splines aswell. Hermite is kinda easy.


---
mithris
 
if the game is just 2d, just use sin and cos commands to do rounded things.

Or open up qbasic, have it export a table of the results, and include it in your code if its a predefined path.

In fact i think qbasic has an example for drawing rounded things with cos and sin.

-Craig

www.gbax.com
 
*sigh*
I was afraid someone was gonna say maths... :(
(never was much cop at maths in school...)

Is there a particular law or formula i need to study??
(or look up in the almighty Google... :) )

I wanna do a nice quick demo for the 15day comp and also just for fun and practice... :D
 
Ok, use circular cooridinates :) I'd make a table with everything you need. Here is an explanation:

X, and Y are normal co-os and you should know about them :) Now circular co-os are R, and Alpha (don't know how to write the symbol) R is the radius of the circle you want to move on Alpha is the angle to be at (up is 0deg, then down is 180deg...) So if you want to move on a circle with R = 10, then you goto Circ-Co 10,0 (R, Alpha) then 10,1.... till 360. Now, you need to convert the circular co-os to normal X and Y, so you need to do some trig here are the fromulas:

X=R*Cos(Alpha)
Y=R*Sin(Alpha)

(the X and Y of the enter are assumed to be 0, so you will have to add the right amount to the result)

Just make a program that will generate all the X, and Y for all the Rs and Alphas you want, then in the program add the X of the center of the circle to X and the same with Y, and you can move to any part around the circle!!

P.S. If the formulas don't work, switch Cos and Sin, they might be in the wrong place. I hope this makes sense as I am in a midnight fit :)
 
Back
Top