I was hoping to see other ways people have accomplished something like this:
Theoretical game requirement using Pokemon as an example
- an array of enemies, with a value defining the type of each enemy
Type, Name, Stat1, etc
Grass, Venosaur, 10...
Grass, Snivy, 5...
Fire, Charizard, 10...
Normal, Toucannon, 10...
If I wanted to, during an encounter event, only allow the "spawned" Pokemon to be of Grass types, this is how I would do it:
- ForEach loop checking rows in the array
- an If event in the loop checking if the string in column 1 of the current row is "Grass"?
That would be using a standard array or a magicDeque object.
Or are there other objects that can accomplish it better?
Coming from Powershell in my professional life, forEach is a superbly useful function, but I know it can slow down unless you narrow the scope a bit on a big operation. Since this isn't a big operation (in my project it would maybe have 100 rows to go through) then it shouldn't really pose any big performance issues should it? There may a couple of other similar loops for other things at the same time during loading of the frame.
On a side note, I found after years using Powershell extensively, the object oriented experience in Clickteam really, uh, clicked with me.