Hi all
I need advice on how to solve a problem I am having.
I am having problems getting correct collision info using CollideImage
I am returning an array of all objects on the same layer/
So for all bullets I am calling collideimage to test if they collide with any enemies.
My code is shaky at best and when I start adding tests for other objects, results get worse.
Would you suggest I try another method ?
The reason I chose CollideImage and returning the array of objects hit, is that I wouldn't have to check for every enemy for every bullet. CollideImage does that for me.
I didnt want to have to do this: pseudo
for each bullet
for each enemy
checkcollision
next
next
here is my collision code
both bullet and enemy are on layer1.
I need advice on how to solve a problem I am having.
I am having problems getting correct collision info using CollideImage
I am returning an array of all objects on the same layer/
So for all bullets I am calling collideimage to test if they collide with any enemies.
My code is shaky at best and when I start adding tests for other objects, results get worse.
Would you suggest I try another method ?
The reason I chose CollideImage and returning the array of objects hit, is that I wouldn't have to check for every enemy for every bullet. CollideImage does that for me.
I didnt want to have to do this: pseudo
for each bullet
for each enemy
checkcollision
next
next
here is my collision code
both bullet and enemy are on layer1.
ResetCollisions(1) colList:Object[] = CollideImage(bulletImg,xpos,ypos,0,ENEMY_LAYER,0) For Local i:Int=1 To colList.length If(TEnemy(colList[i-1])) DrawText "Collision!",10,10 end if Next