Testing For Collisions

BlitzMax Forums/BlitzMax Beginners Area/Testing For Collisions

Eric(Posted 2005) [#1]
If I Have a Type "Enemies" and I extend that type with say "Baddie 1" and "Baddie 2" I iterate through all of the Enemies that I have added to the "EnemyList:Tlist" How can I detect collisions between "Baddie 1" and "Baddie 2"

Type Enemies has an Abstract Update Method so "Baddie 1" and "Baddie 2" have differend Methods for update.

I iterate through the with a simple

For Temp:Enemies=Eachin Enemylist
Temp.update()
Next

I can't fiqure out how to compare all enemies with all other enemies.

I hope this all made sense.


Dreamora(Posted 2005) [#2]
Do you mean something like:
If Baddie1 (temp)
 ' do something
elseif Baddie2 (temp)
 ' do something different
endif



MattVonFat(Posted 2005) [#3]
Would you mean something like this?

For Temp:Enemies = Eachin EnemyList
  For Temp2:Enemies = Eachin EnemyList
    If Not Temp.ID = Temp2.ID
       Check collison
    End if
  Next
Next



taxlerendiosk(Posted 2005) [#4]
It may not be obvious what Dreamora means - you can use the name of the type as a "function" that returns true if what you pass it is a valid instance of that type, and false otherwise.

However, you may be confused about how you use the actual collision functions or something?