Types scan

Blitz3D Forums/Blitz3D Programming/Types scan

You're not giving them different names, you're just creating a variable.

It's no different from saying:

For Even=0 to 9
   Print Even
Next


And

For Odd=0 To 9
   Print Odd
Next


They're both going to print the same thing. Just because you called the variables something different doesn't change anything.

If you only want to update enemies of a certain type, you're going to need to have a field within the type which stores the type of the enemy, and then check it when updating.

Const ENEMYTYPE_GRIFFON=1
Const ENEMYTYPE_TROLL=2

For MyEnemy.Enemy=Each Enemy
   If MyEnemy\Type=ENEMYTYPE_GRIFFON
   End If
   If MyEnemy\Type=ENEMYTYPE_TROLL
   End If
Next


Etc.

I should possibly point out that BlitzMax would make this much easier, as it not only allows you to create your own collections of objects so you could have a list for each enemy type, but it also features inheritance, so you could have trolls and griffons extend a base enemy type, allowing you to cycle through a list of all enemies and still only pick out the enemies of a certain type.