Following a path...

BlitzMax Forums/BlitzMax Beginners Area/Following a path...

spraycanmansam(Posted 2007) [#1]
Hi guys,

I'm interested in trying to make a 'shoot the gems' kind of game. What I need help on is the concept of making the gems follow a pre-determined path?

Thanks heaps!

Cheers,
Sam


Ked(Posted 2007) [#2]
You could make the path out of points (x,y) and store each path in a separate file then load them into Types.


Derron(Posted 2007) [#3]
You could also draw the path into a special map and then follow it pixel by pixel.

The other one is: mark certain points as base-path and connect them using bezier-curves - so you avoid a big bunch of points to make a nice curve-movement.


bye
MB


CS_TBL(Posted 2007) [#4]
But how important is that big bunch anno 2007/2008? If one path has 1024 points (512 x and 512 y), then a whopping 1024 of those paths will only cost 1MB when using bytes or 2MB using shorts ..


Derron(Posted 2007) [#5]
if you say:

point1: 10,10
point2: 11,11

then you missed more than a dozen of fractional points between - else (adding more points) you will not have only 1000 pathpoints.

Using bezier curves you are able to get each point you are interested in and so you also remove jagging when eg. rotating a ball around the curve.


bye
MB


grable(Posted 2007) [#6]
Why not use vectors? i was wondering about the same thing so i cooked up this example.
Note: if you dont need turning, you can remove the heavy duty math thingy, and replace DirX/Y with dx/dy.