In my game I have a system where you can drag objects around, but in the engine it drags two objects at the same time if they are overlapping. Here's a link to the open-source, hoping that someone here might be able to help!
Use an 'Only one action when event loops' condition, that *should* fix it. Maybe. Alternatively, store the fixed value of the object in a counter, and select the object by its fixed value in the next event.
Thanks FireMonkey for helping!
Well just adding "Only one action when event loops" didn't work. Doing the other thing works fairly well if each object is a seperate active object, but I forgot to mention that my game will use multiples of 1 active object.
So, it doesn't work quite yet. Here is the pregress, doing both of the things you mentioned:
Setup: getting alterable value to correspond with layer.
Create all objects (either in level editor or in-game) in the order you want them layered (back-to-front).
Spread value 0 in the active object's alterable value A.
Start loop "layer" for the number of Object times.
On loop "layer" & Object's value A = loopstep of "layer": set object to front.
Checking: finding highest alterable value A of those clicked on.
Make 2 counters: goCheck, and Highest, setting them each to 0 initially.
User clicked on Object + Object's Flag 2 is off: set flag 2 on, add 1 to counter goCheck.
Counter goCheck = 1: set goCheck to 0.
Counter "goCheck" > 1: run loop "findHighest" number of Object times.
On loop "findHighest" & alterable value A of Object = loopstep of highest & Object's Flag 2 is on & Object's alterable value A > Highest: set Highest to Object's alterable value A.
On loop "findHighest" & alterable value A of Object = loopstep of highest & Object's Flag 2 is on: set Object's flag 2 off.
Loop "findHighest" ends & Object's alterable value A = highest: set Object's flag 2 on & set highest to 0 & set goCheck to 0.
Coming out of the loop findHighest, which only triggers if you click on more than one object at once, only the highest layered object clicked on will have its flag 2 on.
"Omg. Where did they get the idea to not use army guys? Are they taking drugs?" --Tim Schafer on originality in videogames
Using that fixed value method does work with multiples of the same object because I remember finding that method using the same object, with the added benefit that it picks the top object (at least I remember it doing that).
The reason its not working in your file is because you're using the Counter object's compare condition. You need to use the compare condition of the active object to get it to pick an instance of it. In the active object's conditions its Alterable Values>Compare to fixed value.
Wouldn't the "Only one action when event loops" work if the object were both of the same qualifier and the conditions involved the qualifier instead of two separate objects?
Ohhhh man.. Well, I'll try that Noyb, but it looks hellishly complicated :\ and I've never done anything with loops and loopsteps before. I'll give it a try though, since you were kind enough to put forth the effort for it. Thanks to everyone involved!