Energy Engine
Member
Hi again,
I'm attempting to implement grids, but have stumbled upon an issue with respect to setting the grid to have all the entries I need.
To begin, it'll be helpful to visual the system. Imagine a variable number of red match boxes (red team) and a variable number of blue match boxes (blue team). Each box contains its own custom amount of match sticks. The goal is to get a grid for each color side containing the instance IDs of all of the matches in each box in that team, as well as some other variables for each match. So two grids - one for red and one for blue.
The problem I'm having is I'm not able to set the grids dynamically so that each box in a color team feeds its grid the instance ID+other info of each of the matches it contains. It only seems to work for one box.
The relevant code for adding the instance IDs for the "match box" is below:
Please note that the global.pool_slots variable is the number of matches in each box. For the sake of simplicity, I've it set it to 2 for all boxes, but in the actual game, this is intended to be variable for each box. Also, in this example only one grid is being used and there are two boxes per team in the room. The above correctly outputs 2 entries for the grid and displays their name (with the con_char variable). I expected the code to do this for each match box instance in the room. However, this only happens for one and only one box. How do I get it to do this for all the boxes, given each box will have its own slots amount? All in all, I should see the one grid I have display 8 entries (2 matches per box * 2 boxes * 2 teams).
Thanks for any guidance in advance!
I'm attempting to implement grids, but have stumbled upon an issue with respect to setting the grid to have all the entries I need.
To begin, it'll be helpful to visual the system. Imagine a variable number of red match boxes (red team) and a variable number of blue match boxes (blue team). Each box contains its own custom amount of match sticks. The goal is to get a grid for each color side containing the instance IDs of all of the matches in each box in that team, as well as some other variables for each match. So two grids - one for red and one for blue.
The problem I'm having is I'm not able to set the grids dynamically so that each box in a color team feeds its grid the instance ID+other info of each of the matches it contains. It only seems to work for one box.
The relevant code for adding the instance IDs for the "match box" is below:
Code:
for (var i = 0; i < global.pool_slots; i++)
{
spawn=instance_create(x,y,ocon_op) //<- ocon_op is the "match stick"
spawn.myid=id;
spawn.entry=i;
spawn.team=pool_team
if (global.vio==1
{spawn.con_char=arcade_selection}
else
{spawn.con_char=debug_selection}
ds_grid_set(ocon_local_match.grid_t,0,spawn.entry,spawn.id)
ds_grid_set(ocon_local_match.grid_t,1,spawn.entry,spawn.con_char)
}
Thanks for any guidance in advance!
Last edited: