New strange things... Collisions
Background:
I have 1 collision event that tests when the blaster hits group.enemies. On the event, the blaster is destroyed and 1 hit point is deducted from the Group.Enemies object that got hit.
If the Group.Enemies object is reduced to 0 hit points, said enemy blows up (fast loop is called) and a star appears (power-up style).
There are usually about 15 or so enemies on the screen at any given time.
PROBLEM:
every now and then when only 1 enemy gets hit, ALL the Group.Enemies vanish and 1 star power up appears in place of each.
This is VERY frustrating because it totally ruins the game play.
I thought perhaps it had something to do with the Qualifiers, (an error therein). So i re-wrote it without using Qualifiers and I still get the same problem.
Has anyone seen this type of glitch, where MMF2 seems to get confused on collisions?
Re: New strange things... Collisions
It very likely has something to do with how your code is formatted and in what order the events occur. These sorts of problems are almost always caused by an issue with the way objects are "scoped" by the object scope list, which controls which objects actions will apply to.
Which is impossible to know without seeing your code
Re: New strange things... Collisions
I had a feeling that would be the response. It's impossible to diagnose anything without seeing code.
I'm so old school that I really don't like to let everyone see my code. I'll keep toying with it, if I can't find the problem, I'll bite the bullet and post the code.
Thanks!
Re: New strange things... Collisions
The best advise I can give is to study the order of the "Object Scope List" and understand how it works, because that is likely what is causing your problem.
The object scope list tells MMF which objects to apply a given event (and further conditions) to, and is determined by conditions. If all your objects are being destroyed and replaced, it means all your objects are being scoped somehow.
A very likely way this can occur is that you have actions that take place after a call to a fast loop inside an event. MMF does not preserve the object scope list on its stack frames (it really should!), and so any actions that take place after a fast loop call will take place on an empty object scope list- and generally apply to everything.
For example, if you have code that looks like this:
+On Collision Between A & B:
= Start Loop "LoopName"
= Destroy A
the call to "start loop" would reset the object scope list- making it no longer scope the colliding objects only, and start scoping all objects again- this would cause all objects to be destroyed.
Re: New strange things... Collisions
Yes, I learned a long time ago that once you call a fast loop, things don't work well if called after the fast loop. I always call fast loops last.
This is still very useful information, and I'll continue to try and solve this issue.
Re: New strange things... Collisions
Ok, I solved the problem by:
Setting a global variable to hold the Fixed Value of the Group.Enemies active that was hit.
SO, while testing IF Group.Enemies.HitPoints <=0 I'm also testing to ensure the Fixed Value of said group.enemies active is the same as the stored value.
No more errant exploding enemies! I really should have thought of this before.
Re: New strange things... Collisions
It's coming along nicely...
I can't seem to get much more done because I play for hours, then make a 2 minute code change, then play again for hours!
http://WeThrill.com/Screenshot1.png