Collision Mask Overlapping
I'm having this issue with the way MMF2 handles overlapping. I'm trying to create some events that will allow me to use ONE active object to both display a visible animation, and have a hidden collision mask.
The events should work like this:
1. Set Collision Mask Animation (stopped)
2. Do any collisions needed (Player vs. Active Obstacle)
3. Set visibile Sprite Animation (walking)
So, theoretically, this SHOULD switch the object to a collision mask, do collisions with it, then switch to a different animation at the end of the frame.
But this isn't happening. No matter what I do, the collision events are ignored, collisions occur on the wrong animation, or collisions are buggy. Maybe I just don't understand how overlapping/collisions work in MMF yet. I thought I'd get it after a couple of years! But still its a mystery to me.
I have a very simple example file here, and would VERY much appreciate a solution to this issue.
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=220699
It seems that MMF2 doesn't allow you to use one animation as a collision base, then switch to another one before it draws the frame. It seems to always use the LAST set animation for all collision events in the whole frame.
Re: Collision Mask Overlapping
Instead of changing animations, just change direction.
Re: Collision Mask Overlapping
Will that work?
I just tried your solution. It doesn't work. Changing the direction still applies the overlapping condition to the WRONG direction.
I don't understand how it DOESN'T work; the logic flow goes like this:
1. Always: Set direction to RIGHT
2. Do collision events
3. Always: Set direction to LEFT
But the program is performing the overlapping/collisions on the image in the LEFT direction! As you can see, this direction should be set AFTER the collision, and changed BEFORE the collision.
Therefore, the collision event should NEVER occur while the Active Obstacle object is in its LEFT facing direction, but it does!
The collision event is triggered as it is overlapping the object in its Left facing direction. How is this possible?
Re: Collision Mask Overlapping
Are you using the "Collides with" condition as the first line of the event? (Is it highlighted in red?) If so, this event will be executed out of order of the rest of the event list, as soon as it occurs (possibly due to other preceding events) - try adding an "Always" to the top of the event.
Re: Collision Mask Overlapping
No, I am using overlap. I have uploaded another very simple example here:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=220798&#Post220 798
This screen shot should explain everything. PLEASE look at the example file too, "Collision Check 2". Its only 4 events long.
http://fc07.deviantart.net/fs71/f/2011/026/c/9/sample_by_pencilgoblin-d3845u0.png
http://fc07.deviantart.net/fs71/f/20...in-d3845u0.png
Re: Collision Mask Overlapping
I actually build my collision masks into my objects whenever I can, rather than having two objects following each other. Here's an example of this. The downside of this that you can't test an object's hidden collision mask frame against an other object's hidden collision mask frame, due to some MMF2 limitations (if you test for overlap between two objects, and the second object in the condition was moved or changed somehow previously during this frame by an event, that update isn't taken into account when compared - in other words, the second object will have the position and collision mask it had in the last rendered frame).
I know it's annoying. I scratched an entire game idea, because I couldn't move multiple objects around, changing animation frames and testing for collisions in any combination, within a single frame.
Re: Collision Mask Overlapping
I see. So the second object in comparison isn't updated. Well, that gives me an idea. What if you simply compared BOTH objects?
Code:
*Player overlaps Obstacle
+Obstacle overlaps Player
This way it compares BOTH objects against each other, giving both objects the chance to be the primary object in comparison.
Actually, I just edited the program to test this theory, and it works! If you check for overlap on both objects in two conditions, the overlap condition is solved.
I have updated the example here to show this result:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=220798#Post2207 98
There are a few problems that could occur from this method:
1. The double collision-comparisons on each event could slow down a larger application a lot.
2. With many objects to test for (not just 2), the events could get complicated.
3. The collision check may not work as expected with Qualifiers.
I will further experiment with this idea. I'm going to make some stress-tests to see what it can and can not do. I'll post relevant information here.
There really needs to be a definitive guide on how MMF2 deals with collisions!
Re: Collision Mask Overlapping
Thanks for the information... I was trying to figure it out myself then Nifflas posted, then JimJam posted...
I was with the spread value method... create and position a dummy object (as mask) at each instance to check for collision detection. Seems like you guys have provided a better and simpler solution.
Didn't know double checking the collisions could worked out the way it did :D
Thanks a lot :D Really thanks... :D
Re: Collision Mask Overlapping
No problem. I was having the same issue.
In my game I was using the double-actives for collision/sprites. But this was causing slowdown in my game when I had more than 200 objects per level!
I'm going to be doing some stress tests to see how far this double-checking method can go before I implement it. I suggest you do the same, so we don't run into another wall of glitches half way through our games!
Re: Collision Mask Overlapping
Through some experimentation, this method of double-checking collisions does seem to work if you use Qualifiers.
But, it doesn't seem to work at all if the "collision mask" is larger than the "sprite". It only works when the Mask is smaller than the Sprite. To test for proper overlap when the Mask is larger, you must only use the condition that compares the Masked object first.
And in the case of my main project, it creates odd effects if the Mask is the same size as the Sprite. It looks like this method is not going to work for me.
Is there ANY way to force MMF to see the updates to objects when comparing collisions? What can I do at this point, since my own work around doesn't work?
Re: Collision Mask Overlapping
So I pretty much HAVE to use 2 active objects for every object in my game?
I'm trying to recreate a NES game engine (Super Mario bros.) and I have to use 2 Actives for every Brick block in a level now. In levels with lots of blocks that can easily climb to over 400 objects in levels that are only a few screens long! What am I supposed to do here?
Now I have to write my own object memory handling routines so I can dynamically keep the number of objects on screen at once by reading directly from the level array? There's no telling what that would do to the frame rate. I'm running out of options. I've already re coded engine 3 times now to account for work-arounds to major flaws in MMF's object handling.
This is ridiculous. I shouldn't have this much trouble attempting to recreate primitive NES functionality in MMF2. I might as well be coding it in C++ on an NES at this rate.
I've had set-back after set-back all month that I've used MMF2. This might have to be the 4th major project I scrap because of limiting MMF restraints. I'm getting sick of this.
Re: Collision Mask Overlapping
@JimJam,
It would be rediculous if it were true. You most certianly do not have to use 2 actives for every brick. In fact you dont have to use 1 active for every brick if you don't want to. There are many ways to accomplish what you want. Many people have created games like and more complicated than a NES mario engine with MMF...even with the older versions of MMF.
I know it is very frustrating when things don't work the way you expect or want (or in the way that seems logical). The best solution is to find out the way it DOES work.
MMF2 can help people make great and sophisticated games faster than anything else I've ever seen or tried, BUT, and this is a big BUT, you can really get very frustrated learning the few quirky ways you have to deal with certian things. Thats what the forums and the huge wealth of examples and tutorials are for.
Its great you have this much passion and you clearly have no problem with logic in general BUT please don't shoot yourself in the foot by letting frustration get the best of you. Most of the few quirks you'll have to learn about MMF2 are there for a logical reason you don't yet know, and are byproducts of the fact that MMF2 can and does do so much for you so quickly.
I wish I had the time to help you with your specific problem, but I'm sure someone else will spot this thread and help you out. The Click community is very friendly that way. :)
good luck.
I'll chek back in when I'm less burdened. I hope you're still around by then.. You'll find MMF2 to be well worth the investment.
remember, you're a logical guy and you're new to this program which is designed to do a lot of stuff for you automatically (leading to forced and invisible logic you don't yet know about). If something is not working and the logic seems good, don't waste time and get yourself frustrated for days trying subtle variations of the same logic, post it up and let those of us who know the quirks explain why its not working.
good luck.