Array of Types
BlitzPlus Forums/BlitzPlus Programming/Array of Types| 
 | ||
| I know this is possible to do and need to do it, however I have never seen any examples of it being done and am getting no where with trial and error Could someone please post an example of how this is done | 
| 
 | ||
| Crappy example, but: Type alien Field energy End Type Dim a.alien(10,10) For x = 0 To 10 For y = 0 To 10 a(x,y) = New alien a(x,y)\energy = Rand(100) Next Next | 
| 
 | ||
| Gotha, thanks Its a good thing I posted here, I would never have tried that syntax on my own | 
| 
 | ||
| Check out my two posts about Arrays of types in this thread: http://www.blitzbasic.com/Community/posts.php?topic=42548 especially the link in my second post. | 
| 
 | ||
| If you make a type that has a field like AlienType% and you only want to process a certain type of aliens it is much better to use an array for that type of alien instead of this sort of code ... 
For a.Alien = each Alien
   If a\AlienType = 1 then
      ;some code
   EndIf
Next
 |