Collisions
From FusionWiki
Collision Types
There are four events in Multimedia Fusion that trigger collisions. These are:
Another Object: Important object (displayed in red). Events associated with this trigger occur once when object collides with another, specified object.
Overlapping Another Object: Events associated with this trigger occur as long as the object is colliding with another, specified object.
Backdrop: Important object (displayed in red). Events associated with this trigger once when an object collides with any backdrop.
Overlapping a Backdrop: Events associated with this trigger occur as long as the object is colliding with any backdrop.
Note: Collisions that start with "Another Object" and "Backdrop" cannot be negated, but events starting with "Overlapping Another Object" or "Overlapping a Backdrop" can. To negate the action, right click the "Overlapping" conditional in the event editor and select Negate.
Collision Boxes
Associating collisions with an Active Object directly associated with gameplay can sometimes lead to complications, for example the object getting stuck in backdrops/other objects. This is especially true if the object has Fine Collision (pixel-perfect) enabled. Thus, in order to avoid many of these problems, it is often best to use a "Collision Box." This is an active object that handles all the collisions for the gameplay object instead of the gameplay object handling them itself.
To create a collision box, create a new Active Object
To create a collision box, create a new Active Object the size of the gameplay object. Then, in the Events Editor, create this event:
Always
- Set X Coordinate ("Collision Box") to X("Player")
- Set Y Coordinate ("Collision Box") to Y("Player")
This will allow the Collision Box to always be at the player object's X and Y coordinates (assuming their hotspots line up. If they do not, adjust the X and Y coordinates in the action's code using X/Y("Player")+ or - whatever, or go into the Active and physically adjust its hotspot).
Note: Sometimes you may have to use the collision box as what is controlled instead of the Player object, for instance, when using the Platform Movement Object.
Finally, under the Collision Box's properties, check off Visible At Start. This will make the Collision Object invisible but allow it to still have actions associated with it.
Other Uses For Collision Boxes
- Make a 1px collision box and place it at the center of the player object to make the player's hit detection minuscule, like in Bullet-Hell Shoot-Em-Ups.
- Use Detector Lines on the sides of the collision box for more precise collisions, like to stop a player when they hit a wall in a specific direction.
- Use the collision box as what is controlled instead of the player object to prevent the player object from getting caught in the scenery.
