Better Collision Technique

BlitzPlus Forums/BlitzPlus Programming/Better Collision Technique

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.

Ah ok I understand your question now.

Basically you want to check if there's a collision, then check where the ball is during that collision in relation to the brick.

If IMAGESCOLLIDE(image,x,y,frame,ball,bx,by,bframe)
  If bx<=x or bx>=x+IMAGEWIDTH(image)  ;if its outside the brick's x
      speedx=speedx*-1
  Endif
  If by<=y or by>=y+IMAGEWIDTH(image)  ;if its above or under
      speedy=speedy*-1
  Endif
Endif


Thats what I would try. This is assuming that your ball is midhandled and the bricks are handled at 0,0.