Type vs Type

BlitzPlus Forums/BlitzPlus Beginners Area/Type vs Type

Kyler(Posted 2007) [#1]
how can i make two of the SAME type interact with eachother but not itself?


Gabriel(Posted 2007) [#2]
For A=Each TypeA
   For B=Each Type A
      If A<>B
         Interact()
      End If
   Next
Next



Buggy(Posted 2007) [#3]
So can this method be used to determine if two images of the same type collide? Nice!


Kyler(Posted 2007) [#4]
Mabey someone could explain this a little better? I dont understand any of it.


Matty(Posted 2007) [#5]
Gabriel's answer pretty much says it all.

Could you elaborate on what you are trying to achieve if the answer was not sufficient?

I'll see if I can help though.

type MyType

field x
field y
field z
field hitpoints
field anythingyouwantetcetc
end type

;create a few type instances (10) for example purpose

for i=1 to 10
a.mytype=new mytype
a\x=;any values you want
a\y=;any values you want
a\hitpoints=;any values you want and so forth
next

;cycle through each type instance and 'interact' (as you say above) with each other type , but not itself

for a.mytype=each mytype
 for b.mytype=each mytype
  if handle(a)<>handle(b) then 
   ;these are different type instances
   interact();some function created by yourself to represent whatever 'interaction' you had intended in your first post
  else
  ;this must be the same type instance, so do nothing
  endif 

 next
next




Note however that the code above will cause each type to 'interact' twice, I'll see if you can work out how.