Hey everybody, this is my first article! Yea! But really, I recently fixed a problem in my next Click game. I figured that there were some people stumped on the same kind of problem (or at least the noobs of us, I'm not sure ) which involved:

#1: The Player

#2: Many of one Monster on the ceiling trying to detect the Player

#3: Many of one Detector that were used to detect the Player

Basically, there was one detector for each monster. I wanted to make it were if the Player is overlapping the detector, the Monster the Detector corresponds with will jump down and run in your direction until it hits a wall. The problem was that I couldn't make each detector correspond with only one monster. Instead, EVERY monster would jump down and run at you!

Simply put, this is the big problem:
How can I make each individual detector apply to only one monster?

There probably is a method out there that's a lot better than this, but this works just fine for what I am talking about. Instead of something like:

Player is overlapping detector-
-Monster sets position to (X whatever, Y whatever)

You must somehow make the Detector so it stands out from the rest and makes only that detector applicable to that event. Right? Well, sort of.

We know that if:

Player is overlapping Detector-

That only the detector that Player is overlapping is affected by the action. If we could somehow have the same affect on the monster, it would have to be included somehow in another Condition. This means that somehow, we must involve the collision of both Detector and Player AND both Monster and Detector in two seperate conditions.

Why? Because you can't have:

Player is overlapping Detector-
Monster is overlapping Detector-

And somehow refer to the same detector.

What you do is create a different Object (shall be called Box from here on) at a point relative from Detector to were Monster is going to be relative to Detector whenever Player collides with Detector. Then, make it were there is a collsion with Box and Monster that makes Monster attack or whatever you want him to do! In simpler words (were whatever refers to the location of Monster relative to Detector. Also were Thing refers to what Monster does upon detecting Player), this:

Player is overlapping Detector-
-Create Box at (X whatever, Y whatever) relative to Detector

Monster is overlapping Box-
-Monster does Thing

NEGATE Monster is overlapping Box-
-Destroy Box

This way, their collision is both included, limiting it only to the things that were invloved in the collision. In this, you can make every individual Monster have its individual Detector without having to make and program a whole lot of copies of it. Also, by deleting Box, it won't repeat Thing after it no longer detects you. Of course, deleting only works if Monster stands still, moves, then moves back. You could instead, however:

Player is overlapping Detector-
-Create Box at (X whatever, Y whatever) relative to Detector

Always-
-Set Position of Box to (X whatever, Y whatever) relative to Detector

Monster is overlapping Box-
-Monster does Thing

NEGATE Player is overlapping Detector-
-Destroy Box

If you have a moving Monster that moves when it sees you, then stops in place.

Everything I just wrote may not make too much sense, but I hope it did! Please be nice, this is my first article! I hope I've aided you on your heroic quest of The Detection Problems. Plz enjoy!