Using structures as arrays - example code

I’ve read lots of threads on how to use structures as arrays. But, I can’t find any examples that explain the process in layman’s terms with a working example that could be downloaded. My thought process is stuck in the way you create, initialize and use arrays in other programming languages. So, the way a structure works has thrown me off a bit. I have included a screenshot of my structure and the code I created. I was just trying to initialize the structure as a single dimensional array using variables and loops. Then I was trying to do the same with a two dimensional array. I am just printing out the array values to the screen for testing purposes. I need to know if this is the correct way to use structures as arrays. I want to create a Connect Four game. If I can figure out how to use structures, I can create any type of grid based games. Any help or opinions would be greatly appreciated.

So I think that’s right.

The thing they don’t mention anywhere (And recommend against just because you’ll forget) is that you can declare variables and arrays/structure variables through events.

If you want to see an example, check my MetroidVania Minimap example here: While I set up the parent variables, I declare the actual subvariable structures (array entries) as part of the events: GDevelop Dynamic Map by Silver-Streak

1 Like

Thanks for the download link. You’re right…I sometimes forget what I called a variable and then have to search through the events to find where I created it. So, I try to create all my variables outside of the events. Plus, I just want them to show up in the drop-down lists when I use an action that changes their values.