Nope. That says Pick all of the sprites that are visible. Then increment your global count. You need a For each, or add Sprite.PickedCount.
Put your Sprite into a Family, then you have two unique objects to work with.
That's pretty much what you have to do.
Develop games in your browser. Powerful, performant & highly capable.
Sprite:Pick top instance
I'm also not sure what you are asking but event 3 will always return 0. Use either floor(random(2)) OR choose(0,1).
You can use this plugin. https://github.com/nutmix/RandomArray2
Do a search on RandomArray and RandomArray2 for examples.
ramones, sorry but this fails if the first parameter is zero.
edit:
ikke2902, yours also fails if the first element is zero.
This would happen if you enable the group and then that group's code is turned on so the same event is triggered in the next group, just due to timing. If you put a Wait 0 before the activate, it will get delayed until the end of the event sheet, and will only get picked up next time.
You'd place your events in a function, and then call the function from those two trigger events.
You can use Groups to toggle whole groups of events.
For #1, The "Main" group would be active, all others inactive.
For #2, the "Sound" group would be active, all others inactive.
etc.
Member since 28 May, 2012