-
Collision Boxes
How do I use built in collision boxes for active object and the ForEach object at the same time in an event? I know when you have built in collision detectors you always have to have "if OBJECT is overlapping something" in that order as the very first condition but ForEach doesn't work if it's not the first condition. I need an "if OBJECT is NOT overlapping something" condition to work with the built in detectors but I need a ForEach condition relevant to the object in question if I want it to only effect that object and not every single one of its type.
-
Re: Collision Boxes
Well... for now I made it generate an active object on every tile around the object I wanted to check if OBJECT is not overlapping... this works for now but I would prefer to do it the other way because this will cut down on active objects at run time but if no one has a solution, I'll just use this.
-
Re: Collision Boxes
Not really sure what you mean by "built in" collision. Are you referring to the collision routines MMF uses? Or making collision shapes in the animation frames?
Maybe provide an example and people will be able to help you out more.
-
Re: Collision Boxes
Making collision shapes in the animation frames.
-
Re: Collision Boxes
I didn't fully get what you wanted, but take a look here:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=download&Number=5975&filename=O verlapping_feat_ForEach.mfa
Its built with the events "Overlapping" and "Not Overlapping", including ForEach event in each :)
EDIT: Adding, the smileys changes emotion, or animation, when they are overlapping and not overlapping. This event can easily be replaced by whatever you want to happen.
-
Re: Collision Boxes
OK I'll explain better what I did. I made collision boxes within the active object's animations. So for it's up detector I have a collision box in direction 7's animation, for right I have a collision box in direction 31's animation, etc.
Before a collision, I put an always event to where if it's facing up for example to set its alterable value Z to its animation direction and then change its animation direction to 7, then check if the object is overlapping a backdrop, then an always event after that where the animation direction is changed back to its alterable value Z. So this results in the active object changing into a collision detector sprite and back before MMF2's frames can update and display the collision detector sprite, so to the player they see nothing except that the active object successfully checked against an obstacle above it.
Now the problem with this method is when you want to check if it's overlapping or not overlapping an active object, you must ALWAYS have this condition first in this order: "if THIS OBJECT is overlapping something else". "If something else is overlapping THIS OBJECT" does not work. Nor does it work if you put the overlapping condition somewhere else in the condition chain. The reference to THIS OBJECT must ALWAYS come first. And this is where my problem stems from because ForEach only works if you put it first in the condition chain.
The example you gave me above does not use built in collision detectors in the active object's animation so it doesn't solve my problem. :(