CollideImage Function?

BlitzMax Forums/BlitzMax Beginners Area/CollideImage Function?

from Denzil's code above

  For B:TBullet = EachIn TBullet.BulletList
    AliensCollided = CollideImage(TBullet.BulletImage, B.X, B.Y, 0, ALIEN_LAYER, 0, Null)
    For i = 0 To Len(AliensCollided)-1
      A:TAlien = TAlien(AliensCollided[i])
      ' Alien = A
      ' Bullet = B
    Next
  Next


Translated into english

for every bullet check to see if where I am next going to draw the bullet will collide with any aliens (or in your case blocks)

AliensCollided is an array which is not evident from the code snippet because it is non strict.

in strict BlitzMax you will need something like

Local blocksCollided:Object[]

to be the variable you use to receive result of CollideImage.

I would personally replace the for next loop with the following:

For myblock:TBlock=eachin blocksCollided()
block.Kill
next

which brings us to the interesting point of how block can delete itself, hopefully it is a member of a blocklist or in an array so your Kill method simply needs to remove it from there.