Collision detection with multiple circles

4 posts

Flag Post

Hey, I’m making a game with a bunch of circles. A smaller circle is controlled by the mouse, while two larger circles float around the screen. When the small circle touches one of the large circles, the small circle changes its color (using the distance formula) by gotoAndStop-ing to a different frame. Here’s the portion of the code I’m having problems with, from the large circle:


The problem is, there are two of these large circles on the stage, and by the end of the game there could be 180 circles on the screen. Circle A’s code overrides the code of Circle B (they are the same movieclips with the same code). When the small circle goes near circle A, it’ll change colors, but when it goes near circle B, it stays at frame 1, because that’s what circle A tells it to do. Am I making sense here? Any suggestions?

Flag Post

Figured it out

I was making it too difficult. Instead of changing frames, you use a variable (i.e. root.hitting=true). You then change the frame on the main timeline (if(_root.hitting==true){root.player.gotoAndStop(2)})

Sorry for the dumb post =D

Flag Post

By the way comments don’t need to be together…

//I like pie, but Greg doesn’t :(

Flag Post

I just did that so it wouldn’t go to the next line. But that wouldn’t matter anyway, now would it…Whateva =)