inertias
Member
Ok, so sorry for the bizarre title. I hope the title and my explanation is good enough to help you guys understand my issue.
So basically, in my game there are units you can create. They get created at your base and then simply move to the right of the screen until they reach the enemy. I want there to be a "queue" or lineup of units.
The queue corresponds to the order of units you created. So you make 1 unit, it is first in line. You make a second unit, it is second in line, etc.
Only the first unit in the queue can attack. All the other units have to wait until they are first in line to attack. If a unit dies, the queue gets shifted so that the next unit is now able to attack.
Here's an example image of what I need:
Maybe this is not the right approach, but I plan to use a ds_grid to accomplish this. I have a script that creates a ds_grid that simply adds the instance of the unit to the grid and then expands the grid's height by 1. If a unit is destroyed, the ds_grid has its height removed by 1, but I don't know how to shift the ds_grid.
Now I want the unit to draw its place in the queue above its sprite. How would I go about drawing the unit's placement in the ds_grid? I can't just draw the height of the ds_grid because that will just display the same number for ALL units, since the ds_height will be the same for all of them. I need to display their unique position within the ds_grid and have that number be shifted if the unit in front of them dies.
Am I going about this the wrong way? Any idea of how you would implement this? Am I not explaining things well?
Thank you for any help you can provide!
So basically, in my game there are units you can create. They get created at your base and then simply move to the right of the screen until they reach the enemy. I want there to be a "queue" or lineup of units.
The queue corresponds to the order of units you created. So you make 1 unit, it is first in line. You make a second unit, it is second in line, etc.
Only the first unit in the queue can attack. All the other units have to wait until they are first in line to attack. If a unit dies, the queue gets shifted so that the next unit is now able to attack.
Here's an example image of what I need:
Maybe this is not the right approach, but I plan to use a ds_grid to accomplish this. I have a script that creates a ds_grid that simply adds the instance of the unit to the grid and then expands the grid's height by 1. If a unit is destroyed, the ds_grid has its height removed by 1, but I don't know how to shift the ds_grid.
Now I want the unit to draw its place in the queue above its sprite. How would I go about drawing the unit's placement in the ds_grid? I can't just draw the height of the ds_grid because that will just display the same number for ALL units, since the ds_height will be the same for all of them. I need to display their unique position within the ds_grid and have that number be shifted if the unit in front of them dies.
Am I going about this the wrong way? Any idea of how you would implement this? Am I not explaining things well?
Thank you for any help you can provide!