Creating 2D paths

BlitzMax Forums/BlitzMax Programming/Creating 2D paths

Takis76(Posted 2015) [#1]
Hello again,

I would like to ask how it is possible to create a 2D path and on this path will move 2D sprites.
I thought if I was paint one with lines but it will appear on the screen and how some image or sprite will follow this path. (To do some special effects).


Ifq200(Posted 2015) [#2]
Use an array with X and y

Local path:int[,]

path = new int[amount, 2]


Takis76(Posted 2015) [#3]
What is the amount? and 2?
:)


H&K(Posted 2015) [#4]
Amount is either the amount of steps OR the amount of turns depending on how YOU do it. "2" is x an y


Ifq200(Posted 2015) [#5]



TomToad(Posted 2015) [#6]
Here's how I would do it, using Linked List and TLink. A little more complicated, but a lot more flexible than arrays.



Takis76(Posted 2015) [#7]
I run the code and is what I am looking exactly , but I haven't understand how to create your path.

The path variable is a 2D array.
The first index of the array is the path serial number (Incremental number]
What you put in the second array index?

It should be 3D array if the first is the number of the path point and the second and third should be the x,y positions of this point.

I try to understand why u use 2D array instead of 3D array.
According how to understand it and how is could be implemented.
[0001,50,23]
[0002,50,27]
[0003,52,25]

Or as I understood after , you store in the first index the number of the path point and in the second index which is from 0 to 1 the x,y coordinates.

Something like this one:

path[0,0] = 5
path[0,1] = 5

path[1,0] = 7
path[1,1] = 8

path[2,0] = 12
path[2,1] = 9

This means the number 0 of the first index is the incremental number and the second index is from 0 - 1


Takis76(Posted 2015) [#8]
I did something but it needs a lots of adjustments to put the path points correctly until create a nice path not random.
I created a small program which I draw the dots of the path and generates the positions x,y with mouse for each point of the path and save them in text file.
Then I add the points manually


:) thank you this does the effect.