imagescollide2
BlitzMax Forums/BlitzMax Beginners Area/imagescollide2
| ||
cant get imagescollide2 to return positive can anyone help? also how would I delete the type instances of the ships that collide? |
| ||
how do you check for collisions of images in the same list? and then delete their types |
| ||
just tho i'd say your checking for collisions in the wrong list. You are going through a collisionList when you should be going through shipList - have you tried putting a End after For Local theship:ship = EachIn collisionListif you have it wont end because the list has nothing in it for it to loop through. When you do get it to collide you can just do somthing like: shipList.remove(self) shipList.remove(theship) oh and make sure you dont do a check on the current ship by putting somthing like: if theship <> self thenwhen you loop through all the ships when you call update. |
| ||
thanks, I tried to loop through the ships in the update method. Using the original list. (Collision list doesnt exist anymore) then it says 'attempt to index array element beyond array length' but I dont think I am using any arrays ?? |
| ||
you are trying to check for frame 1 change it to 0For Local shipy:ship = EachIn shipList If shipy <> self then if ImagesCollide2(my_image,x,y,0,dir+90,1,1,my_image,shipy.x,shipy.y,0,shipy.dir+90,1,1) RuntimeError "collided" Self.red=255 self.green=0 self.blue=0 EndIf endif Next |
| ||
ok heres what I have so far still no collisions though also my ship image isnt being masked at all |
| ||
You're loading your graphics before the Graphics command which causes odd problems. You also need to change the colour back to 255,255,255 if the collision has ended... |
| ||
thanks it works perfectly now, |