As I'm learning Construct while working on my game, I appreciate the amazing fact that there are many ways to code the same thing and it's very dynamic and amazing to me.
So, while I'm working on my game there is a part of the code where I have X amount of instances of the same enemy should be chosen randomly and change direction.
THIS CODE is working perfect, but... one of my goals is to see if I can "compress" some of my code to have more efficient to my eyes and on the way learning new ways to do the same thing.
This is the current code: (works great!)
Notice the Red Enemies Wandering:
If you'll look carefully on the GIF, Every single instance of this enemy is picked randomly and not just ONE at the time but it could be few, each one is affected individually by this code which is exactly what I wanted.
Now, my CHALLENGE is to find a shorter code using "FOR EACH" and maybe "PICK" combined?
Could this be done without additional Variables? that will be magic!
I didn't find a good way to make it work with FOR EACH and PICK: my results always chose ONE at the time. means once it PICKS an instance, it affected ONLY ONE of them at the time, so the others either ALL stopped, or ALL continue walking without stopping at all, which is not what I wanted to do unlike the (working perfect) example above.
Can you please help me Re-Code the same example using the built-in "FOR EACH" + "PICK" events and maybe make this magic in a shorter, simple code? it will be a GREAT way for me to learn as well.
This should be interesting, PLEASE add either example file, GIF or a snapshot of the code so I can give it a try.
Once again: I know, it works, I should leave it like that... but it's a great way for me to learn other ways using FOR EACH and PICK and see different thinking from you guys with much more experience than me.
So the shortest code, the less variables, the better! but do it YOUR way and I'll give it a try.