Embedded Collision Detectors


DISCLAIMER: This don't work anymore as of some new update. Sorry. Felt like a hack dirty anyway. You'll find some another way. May the Gods protect you from a sharp knife in a dark alley real soon.

Collision detection is the process of detecting when two objects are about to collide or have already collided. It is not important to understand how the collision detection algorithm used by MMF2 works, simply that it does.

In MMF2, with a single event, you can check if Object A overlaps Object B. But, what MMF2 cannot do is check where Object A overlaps Object B. It is necessary to know where the collision occurred so that the object may respond accordingly.

Traditionally, an object will be assigned one or more "detector" objects which follow it around and test for collisions between other objects and perform various actions if they do. These can be seen to the left.

But, say you have 20 Turtle objects, each with a left and right detector object. Now all of a sudden you have 40 extra objects.

In this tutorial, you will learn to detect when and where a collision has occurred simply by switching to a different animation within an object and then back again.