Updating enemys

BlitzMax Forums/BlitzMax Beginners Area/Updating enemys

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Presumably all your enemies share similar methods for the most part, although the implementation may be different.

if so, create an abstract parent type and derive the enemies from that. then store them all in the same list.

i.e.
Type TBaseEnemy
     Method Update() abstract
End Type

Type TWarg extends TBaseEnemy
     Method Update()
     'update your warg
     End Method
End Type

Type TOgre extends TBaseEnemy
     Method Update()
     'update your ogre
     End Method
End Type

Type TTroll extends TBaseEnemy
     Method Update()
     'update your troll
     End Method
End Type


As for the collision at this point i´m first looping through all enemys to see if the player collides with any of them, then i´m looping through every enemy and checks each of them against all active bullets fired by the player


Wouldn't it be better to perform both checks at the same time? thereby saving yourself a loop?