since you said you solved the problem already, I havent read it yet, that is good news.
I knew the problem was with the collision code reason being, everyones code worked right, it just frigged up when it came to collision, but the order of the checking wasn't wrong either, meaning If EndIF, If End if, there was nothing wrong with that, it worked for other things. I saw that what was happening was in this case, the front shield was being checked for collision first, and if you rotated, the torpedo would still collide in the area where the front shield WOULD be, if it had not rotated, it was easy to see as you could see the torpedoes go past the other shields slightly, but as you turned slowly watching the torpedo as you came back to face your front shield at it, you would realise the exact place the collision is occuring even when the front shield does not face, is AT the front shield coordinates.
I did the other approach I said I would do, and created T shield. Which has 4 shield arcs which are instanced. I placed two shield arcs to test. Front and Rear. So they rotate and place properly(though no exactly properly as this is just for test) Then I put the exact same collision code from coll_shieldarcs in there, this time when checking for collision with the front shield arc, i use the front shield arcs objects graphics which is shield_front.png and the front shield arc coordinates with fshield.FrontX, fshield.FrontY, and the checks work perfectly. The front shields are hit, the rear is hit, and the etc etc...
here is what I did.
please do not worry with the terrible coding stuff for this type. I was just conjuring it up quickly to test my theory the objects would work, once I tested the collision for each object.
thanks for help guys :)
I knew the problem was with the collision code reason being, everyones code worked right, it just frigged up when it came to collision, but the order of the checking wasn't wrong either, meaning If EndIF, If End if, there was nothing wrong with that, it worked for other things. I saw that what was happening was in this case, the front shield was being checked for collision first, and if you rotated, the torpedo would still collide in the area where the front shield WOULD be, if it had not rotated, it was easy to see as you could see the torpedoes go past the other shields slightly, but as you turned slowly watching the torpedo as you came back to face your front shield at it, you would realise the exact place the collision is occuring even when the front shield does not face, is AT the front shield coordinates.
I did the other approach I said I would do, and created T shield. Which has 4 shield arcs which are instanced. I placed two shield arcs to test. Front and Rear. So they rotate and place properly(though no exactly properly as this is just for test) Then I put the exact same collision code from coll_shieldarcs in there, this time when checking for collision with the front shield arc, i use the front shield arcs objects graphics which is shield_front.png and the front shield arc coordinates with fshield.FrontX, fshield.FrontY, and the checks work perfectly. The front shields are hit, the rear is hit, and the etc etc...
here is what I did.
please do not worry with the terrible coding stuff for this type. I was just conjuring it up quickly to test my theory the objects would work, once I tested the collision for each object.
'shields Type tshield Rem Field frontX = ship.x '- 25 Field frontY = ship.y '- 50 Field aftX = ship.x Field aftY = ship.y Field rightX = ship.x Field rightY = ship.y Field LeftX = ship.x Field leftY = ship.y End Rem Field shield_front:timage = LoadImage("graphics\shield_front.png") Field shield_aft:timage = LoadImage("graphics\shield_aft.png") Field shield_left:timage = LoadImage("graphics\shield_left.png") Field shield_right:timage = LoadImage("graphics\shield_right.png") Function create() Local fshield:tshield = New tshield Local ashield:tshield = New tshield Local rshield:tshield = New tshield Local lshield:tshield = New tshield 'set handle for arcs SetImageHandle(ashield.shield_aft,ImageWidth(shield_aft)/2, -ImageHeight(ship.shipimage)) SetImageHandle(lshield.shield_left,ImageWidth(ship.shipimage)/2, ImageHeight(ship.shipimage)) SetImageHandle(rshield.shield_right,-ImageWidth(ship.shipimage)/2, ImageHeight(ship.shipimage)) SetImageHandle(fshield.shield_front,ImageWidth(shield_front)/2, ImageHeight(ship.shipimage)) 'draw shield arcs SetRotation ship.angle DrawImage fshield.shield_front, ship.x,ship.y DrawImage ashield.shield_aft, ship.x,ship.y DrawImage lshield.shield_left, ship.x,ship.y DrawImage rshield.shield_right,ship.x,ship.y 'collision for each arc respectively For Local etorpedo:ettorpedo = EachIn ettorpedo.list If ImagesCollide(etorpedo.photonimage, etorpedo.x, etorpedo.y,etorpedo.frame,fshield.shield_front,ship.x,ship.y,0) 'handle shields If ship.fore_shield_power < 5 ship.foreshields = False Else ship.fore_shield_power :- 5 texplosions.create(etorpedo.x,etorpedo.y,15) End If 'remove torpedo object when it hits, play shield hit effect. RemoveLink etorpedo.link PlaySound(Shieldhit) End If If ImagesCollide(etorpedo.photonimage, etorpedo.x, etorpedo.y,etorpedo.frame,rshield.shield_right,ship.x,ship.y,0) 'handle shields If ship.right_shield_power < 5 ship.rightshields = False Else ship.right_shield_power :- 5 texplosions.create(etorpedo.x,etorpedo.y,15) End If 'remove torpedo object when it hits, play shield hit effect. RemoveLink etorpedo.link PlaySound(Shieldhit) End If If ImagesCollide(etorpedo.photonimage, etorpedo.x, etorpedo.y,etorpedo.frame,ashield.shield_aft,ship.x,ship.y,0) 'handle shields If ship.aft_shield_power < 5 ship.aftshields = False Else ship.aft_shield_power :- 5 texplosions.create(etorpedo.x,etorpedo.y,15) End If 'remove torpedo object when it hits, play shield hit effect. RemoveLink etorpedo.link PlaySound(Shieldhit) End If If ImagesCollide(etorpedo.photonimage, etorpedo.x, etorpedo.y,etorpedo.frame,lshield.shield_left,ship.x,ship.y,0) 'handle shields If ship.left_shield_power < 5 ship.leftshields = False Else ship.left_shield_power :- 5 texplosions.create(etorpedo.x,etorpedo.y,15) End If 'remove torpedo object when it hits, play shield hit effect. RemoveLink etorpedo.link PlaySound(Shieldhit) End If Next End Function End Type
thanks for help guys :)