Jeorge535, I got your PM asking for more clarification. I'll go ahead and leave my answer here so that other people can benefit from it. Nobody likes searching for an answer online and having it disappear into privacy. Code: Does GML have some kind of array? When I mentioned coordinate_list, I was talking about making a data structure that looks like this:
[(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]
So let me walk you through this more visually. When Yoshi enters the map, you spawn a bunch of eggs at a coordinate like (3, 2), yes? The first step is to fill your entire array with those values:
[(3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
Yoshi then moves, and the first egg object moves towards him. Let's say it moves to (4, 2). So first you shift all of the values in coordinate_list right one index...
[(0, 0), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
And then you add the new coordinates to index 0.
[(4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
The 1st egg moves to index 0, the 2nd egg moves to index 3, the 3rd egg moves to index 6, etc. At this point, the 1st egg has moved and the rest are still at (3,2). Now, we keep moving the first egg and updating the list like so...
Egg 1 Egg 2 Egg 3 [(4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)] [(6, 3), (4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)] [(7, 4), (6, 3), (4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)] [(8, 5), (7, 4), (6, 3), (4, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
Notice how now, the coordinates (4,2) are at index 3 aka coordinate_list[3]. Egg 2 will move to (4,2), which is where Egg 1 was three frames ago. And once Egg 1 updates its position 3 more times, Egg 3 will move to (4,2). The result is that you do movement calculations for Egg 1 while Egg 2 and Egg 3 follow the same path a few frames later. Keep in mind, this is just an example. The list doesn't have to be 8 indexes long and you don't need to use index 3 and index 6 for your eggs. If you use much larger values like a 64-long list with indexes 8 and 16, the eggs will space out more and look better.
Jeorge535, I got your PM asking for more clarification. I'll go ahead and leave my answer here so that other people can benefit from it. Nobody likes searching for an answer online and having it [url=https://xkcd.com/979/]disappear into privacy[/url]. :laugh:
[code]Does GML have some kind of array? When I mentioned coordinate_list, I was talking about making a data structure that looks like this:
[(0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]
So let me walk you through this more visually. When Yoshi enters the map, you spawn a bunch of eggs at a coordinate like (3, 2), yes? The first step is to fill your entire array with those values:
[(3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
Yoshi then moves, and the first egg object moves towards him. Let's say it moves to (4, 2). So first you shift all of the values in coordinate_list right one index...
[(0, 0), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
And then you add the new coordinates to index 0.
[(4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
The 1st egg moves to index 0, the 2nd egg moves to index 3, the 3rd egg moves to index 6, etc. At this point, the 1st egg has moved and the rest are still at (3,2). Now, we keep moving the first egg and updating the list like so...
Egg 1 Egg 2 Egg 3
[(4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
[(6, 3), (4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
[(7, 4), (6, 3), (4, 2), (3, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
[(8, 5), (7, 4), (6, 3), (4, 2), (3, 2), (3, 2), (3, 2), (3, 2)]
Notice how now, the coordinates (4,2) are at index 3 aka coordinate_list[3]. Egg 2 will move to (4,2), which is where Egg 1 was three frames ago. And once Egg 1 updates its position 3 more times, Egg 3 will move to (4,2). The result is that you do movement calculations for Egg 1 while Egg 2 and Egg 3 follow the same path a few frames later. Keep in mind, this is just an example. The list doesn't have to be 8 indexes long and you don't need to use index 3 and index 6 for your eggs. If you use much larger values like a 64-long list with indexes 8 and 16, the eggs will space out more and look better.[/code]
_________________
|