I don't know what you call it but it's that usual bug where when you do
When A overlaps B, XPosition("B")=XPosition("B")+XPosition("A")
it moves all the B objects or moves it according to the position of the latest A object. I think you guys know what I mean.
The question is, how the hell do I get rid of that? The classic solution is to add a Pick Y at random, but that doesn't work with timed events. Any other solutions?
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
I think the problem is that it is only narrowing down the selection list of the A & B objects for ONE of the two involved in the "A is overlapping B", not both. This should ALWAYS be either the first one or second one, don't remember which.
So it might be like if you put
"A is overlapping B"
All events would reference only the B object thats overlapping, while referencing ALL A objects still.
I guess the best workaround would be to have your movement triggered so that instead of moving all your objects in the same frame, you run a loop that iterates through them, and chooses a single A & checks it for collision with B, hence narrowing the selection to a single A & B
So instead of doing:
+Always
=Set Pos(A) to (Pos(A)+Velocity(A))
+A is overlapping B
=Set Pos(B) to (Pos(B)+Pos(A))
You could instead do something along the lines of:
+Always
=Set A Flag 0 off
=Set A Flag 1 off
=Start Loop "Safe Movement" for (# of A objects) Loops
+On Loop Trigger "Safe Movement"
+A Flag 0 is off
+Pick an A at Random
=Set A Flag 0 On
=Set A Flag 1 On
+On Loop Trigger "Safe Movement"
+A Flag 1 is On
+A is overlapping B
=Set Pos(B) to (Pos(B)+Pos(A))
+On Loop Trigger "Safe Movement"
+A Flag 1 is On
=Set A Flag 1 Off
Hey, that works! Lol, I've been placing that liberally and it's fixed almost every bug in my game. I commented it as the "pixelthief code" for lack of a better name (and as a small acknowledgement to your help). Lol, nothing better than having a theorem, a piece of code, or an engine named after you
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
And qualifiers. I had a "damn this code!" fit last night, only to realise that MMF was randomly activating a flag for a qualifier which I didn't tell it to touch. I used flag 7777 and 7778 per code above for Group.Enemies and Group.Friends, both of which are never the same thing, but for some reason, when I activate the flag for Group.Enemies, it also activates the flag for half of Group.Friends!
So after another hour wasted noticing the bug, swearing at the computer, and trying random things to workaround MMF2's built-in qualifier bug, I found out that I could fix it by using flag 7779 and 8000 for Group.Enemies instead. Good thing MMF has unlimited flags
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Jamie posted some code for converting one alterable value into 32 more flags on the Clickteam forums a while back, it used bitwise operations I think...
I often tend to use Alterable Values instead of flags.
Like for instance instead of having a flag set on for a value to count to 30, I'll just set it to one, and then have code for it to increment when only 1 or above. It works quite well, less messy than using loads of flags.
Also, Muz, have you tried the Select Object extension?
Check out my Telekinesis'em'up Thread and the ALICE Machines -
There's a select object extension? Lol, there's so many extensions out there I haven't really bothered to look at all of them. Thanks!
Oh, there's also a flag object extension for those who feel the need to use several flags. I somehow assumed since the flag objects can support practically limitless flags, MMF should have the same feature built in..
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Originally Posted by Muz There's a select object extension? Lol, there's so many extensions out there I haven't really bothered to look at all of them. Thanks!
Oh, there's also a flag object extension for those who feel the need to use several flags. I somehow assumed since the flag objects can support practically limitless flags, MMF should have the same feature built in..
Go ask them about it on the forums, they'll probably add it in a future release .