Sometimes don’t you wish that each and every one of the enemies in your platform game had its own set of collision detectors? You could use those collision detectors to create a platform engine and all your enemies could then move around independently with that platform engine. If you look at any well-known Mario platformer, for example, the enemies can jump onto slopes and moving platforms, bounce off walls, fall through spinning blocks, and basically move just like Mario does in his environment. This can be done in Multimedia Fusion if all your enemies have a platform movement. This is difficult to do if you want to use external collision detectors for your enemies. Well, I think I’ve found a ‘new’ unorthodox way to do collision detection. I don’t know if this has been done before, but I’d like to share this method with all of you. It might be useful in more ways that just ‘enemy platform movement’.

To add ‘embedded or inbuilt collision detectors’ to your enemies, you first need to make a comment in the event editor to keep yourself organized. First type out the name of every collision detector and separate each name by a line break. Here’s an example:

Head Detector
Left Wall Detector
Right Wall Detector
Bottom Detector Shallow
Bottom Detector Deep
Slope Detector

Etc.

Once you’ve done this, you need to take a look at your enemy. Look at which animation directions are already occupied. Most enemies would have just 2 directions occupied for the animation, Direction 0 and Direction 16, the perfect left and right directions. Let’s assume in this example, that our enemy’s Direction 0 and Direction 16 are occupied. For each detector, pick a different number between 0 and 31 excluding 0 and 16 and type that number next to the detector name in the comment you created. Here’s the continuation of our example:

Head Detector 1
Left Wall Detector 2
Right Wall Detector 3
Bottom Detector Shallow 4
Bottom Detector Deep 5
Slope Detector 6

None of the numbers we assigned to the detectors are 0 or 16. That is important, because we are going to occupy those directions now. Now you get to actually design the detectors. Go the animation editor for your enemy. First we need to create the head detector (look at the list in the comment we made). There are two ways to do this: the easy way and the hard way. Let me discuss the easy way first. READ both! For people who don’t understand my description of the hard way, the easy way will make WAY more sense, and you might even understand the hard way after you read the easy way. Just make sure to read both. I don’t know which method is more efficient…

===================

The Easy Way
Copy a frame of your enemy’s walking animation. Go to Direction 1 (you’ll have to create it), and paste the frame. The reason we went to Direction 1 is because that’s the number we assigned the Head Detector. And just in case you don’t know where Direction 1 is ... well, the directions start from 0, the very right direction, and start increasing 1,2,3... counterclockwise until 31. So, anyway... you pasted the frame. Go to the image editor to edit that frame. Now decide where you want to place your collision detector relative to the character. Simply draw out the collision detector in that position, and then erase everything else.

What if you want to draw your collision detector at a region outside of the canvas? You’ll need to enlarge the canvas without changing the position of your hotspot. To do this, follow this procedure. Press Ctrl + W to go to Enlarge Canvas. Add 20 to both your width and height. Press Enter to go back to your editor with the newly made changes. Now, click on the hotspot tool and look on the top where it shows the coordinates of your hotspot. Add 10 to both the X and Y. Your hotspot should now be in the same position relative to your enemy as it was before (if you want to know what we did here ... Basically, when you enlarge vertically by a certain amount, you need to divide that number by 2 and add to the Y of the hotspot. If horizontally, then do the same thing except for the X of the hotspot).

Now that you’ve done this, you can draw out your collision detector where you want it to be relative to your character. This way is easier than the hard way because you can visualize your enemy and where the detector will be relative to it. And it doesn’t have to be JUST a pixel. It can be a line, or maybe a curve. Anything that you need. Just draw it out like when you would’ve created a normal collision detector. After you’ve drawn your detector, erase everything else. There should now be a large canvas with a collision detector drawn. Since in this example, we need the Head Detector, we’ll first enlarge the height of the canvas by 20 pixels, and then add 10 to the hotspot. After this, we’ll draw a little line on top of the enemy. Then I’ll erase the enemy. That leaves the detector, and nothing else should be on the screen. Some people are in the habit of shrinking. DON’T shrink in this case, even if it looks sloppy. We want the detector to be relative to the enemy at the position you placed it. So, that’s all for the creation of a detector. Just exit out of the screen, now. You’ve successfully created the Head Detector.

The Hard Way
Go to Direction 1, and enlarge your canvas to any size. Draw out your head detector. Remember that it can be a pixel, or it can be a line; anything you need. Draw it out just as you would an external detector. After you do this, shrink the canvas. Now comes the part that makes the hard way ‘hard’. You need to position the hotspot relative to the hotspot of your enemy’s normal animation so that the detector will work properly. If you read the Easy Way, you should understand what we want to do here. One way to go about doing this is to go to one of your enemy’s walking frames, and measure the X distance and Y distance from the position where you want the detector to the X to the hotspot position. I know most people wouldn’t prefer this way, but that’s the way I did it in my game, simply because I like my animations to be shrunk, for some reason. I’m ‘one of those people’ that I described in the Easy Way section.

===================

So after you’ve created the frame for your detector, you need to duplicate this frame as many times as the number of frames in your enemy’s walking animation, so ... if your enemy has 4 frames in its walking animation, create 4 duplicate frames for the detector.

Yes! So you created your detector. Now just create all your other detectors in the same way. The process seems long, but it’s actually not. It’s just because I had to write SO much to help you understand EXACTLY what I’m trying to say. The actual process just takes a couple minutes per sensor. Easy!

Anyway, so you’ve created all your detectors and you’re ready to get them working in your game. To the experienced users, by now, you might be able to understand how to use these sensors in your game. If this is not the case, then read on.

Think about how you use normal detectors in a platform movement to test to see if the character is hitting a wall, or a ceiling, or is standing on the ground. We use the condition – If SOME Detector is overlapping a backdrop, then do SOMETHING – right? So we need to test to see if a particular detector is overlapping a backdrop, or an active, or something else. How would we do this with our little inbuilt collision detectors? Well, instead of doing this using one event, we need 3 events:

Always
- Set Alterable Value C (“Enemy”) to Dir(“Enemy”)
- Change Animation Direction to D .... where D is the value of your collision detector

If Enemy Is Overlapping Something
- Do something

Always
- Change Animation Direction to Alterable Value C (“Enemy”)

Let me describe in detail what’s going on exactly. The first event of the set stores the current animation direction of the enemy in a variable, and then the ANIMATION direction is set to the ID of your collision detector. If we wanted to test for the head detector in this example, we would put ‘Change Animation Direction to 1’. We would simply select from the direction selector that pops up. No calculations needed. Remember to change the ANIMATION direction, NOT the DIRECTION direction.

So anyway, what this does is change our ‘enemy’ object into our detector object. Smart huh? Then we do all our tests. You can have more than one middle event, but all the middle events occur while the Enemy object is in the ‘detector’ form, remember that. Anyway, after we create our middle event, we need to change the enemy back into its original direction ... the last event up there. We stored the direction in a variable, so we simply retrieve it from that variable. We need to set the direction back so that the player of your game doesn’t see your enemy change into a detector. Get it? You should, by now. Also, remember that if you separate each set of 3 events by a comment, as I did in the example, its way more organized.

Finally, if you enjoyed this article, and also enjoy electronic music, please listen to my new song, and consider buying it if you like it: http://youtu.be/CDOks1ySnL8?hd=1

Yes, I know, shameless advertising, but this article is extremely old