imagescollide2

BlitzMax Forums/BlitzMax Beginners Area/imagescollide2

slenkar(Posted 2005) [#1]


cant get imagescollide2 to return positive

can anyone help?

also how would I delete the type instances of the ships that collide?


slenkar(Posted 2005) [#2]
how do you check for collisions of images in the same list?
and then delete their types


Diablo(Posted 2005) [#3]
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 collisionList
if 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 then
when you loop through all the ships when you call update.


slenkar(Posted 2005) [#4]
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
??




Diablo(Posted 2005) [#5]
you are trying to check for frame 1 change it to 0
For 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



slenkar(Posted 2005) [#6]
ok heres what I have so far

still no collisions though
also my ship image isnt being masked at all


tonyg(Posted 2005) [#7]
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...



slenkar(Posted 2005) [#8]
thanks it works perfectly now,