So I just added two enemies moving on the same platform and when I shoot one, after several seconds the other one disappears with out it hitting anything and vice versa. I know that it is something to do with the collision because I didn't draw the one of the enemies, I shot one and I didn't die when stood on the platform for a while. But I can't see what is wrong with it. Especially as the other enemies work fine (Removed some irrelevant code).

______________________________________As long as it remains classified how long it took me to make I'll be deemed a computer game genius. - William LabbettTheory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why. -UnknownI have recklessly set in motion a chain of events with the potential to so-drastically change the path of my life that I can only find it to be beautifully frightening.

Dizzy, I'm sorry but this code is ok... there's a little bug that uses height instead of width once (he couldn't notice it if they are equal), but otherwise it's intended to check if two rectangles overlap :

Nope. According to his logic, if my arrow is farther right OR higher than the enemy, there's a collision. No box involved.

You seem to fail to see that the return statement reached when the condition is true returns false. That code checks for all cases where there is no collision, and returns true otherwise.

" There are plenty of wonderful ideas in The Bible, but God isn't one of them." - Derezo"If your body was a business, thought would be like micro-management and emotions would be like macro-management. If you primarily live your life with emotions, then you are prone to error on the details. If you over-think things all the time you tend to lose scope of priorities." - Mark Oates

Ha, I just came back to this thread to see if it got resolved and I got a good chuckle from the stream of posts .

EDIT:
If all that is needed is to check whether two bounding boxes collide, the negated method works fine and is actually a little more optimized since it bails early if one of the checks fails. Of course it's a nearly worthless optimization.

______________________________________As long as it remains classified how long it took me to make I'll be deemed a computer game genius. - William LabbettTheory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why. -UnknownI have recklessly set in motion a chain of events with the potential to so-drastically change the path of my life that I can only find it to be beautifully frightening.

______________________________________As long as it remains classified how long it took me to make I'll be deemed a computer game genius. - William LabbettTheory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why. -UnknownI have recklessly set in motion a chain of events with the potential to so-drastically change the path of my life that I can only find it to be beautifully frightening.