Is it possible to iterate through a list of a custom type with a "for each" loop and then do the same within that loop?
For instance, say I have a custom type called particle.
Type particle
Field x,y,w,h
End Type
Now I create a bunch of particles and I want to run collision routines on them.
for p.particle = each particle
for c.particle = each particle
if c <> p and rectsoverlap(p\x,p\y,p\w,p\h,c\x,c\y,c\w,c\h) then
; collision takes place
end if
next
next
I'm trying to do something like this but as soon as I reference the variable c I get an error about it not being a custom type. Is there a different way to do this?
For instance, say I have a custom type called particle.
Type particle
Field x,y,w,h
End Type
Now I create a bunch of particles and I want to run collision routines on them.
for p.particle = each particle
for c.particle = each particle
if c <> p and rectsoverlap(p\x,p\y,p\w,p\h,c\x,c\y,c\w,c\h) then
; collision takes place
end if
next
next
I'm trying to do something like this but as soon as I reference the variable c I get an error about it not being a custom type. Is there a different way to do this?