Over the past couple days, I've been playing around with a new game. I've found some interesting things that I didn't know about before; mainly Trigger Once. I've always had issues in the past using this with multiple instances, but have finally realized that if 2 instances do something at the same exact time, because the trigger once is global it will generally break the event.
So my request, or rather inquiry, is this; is there a way to get a "trigger once" for a sprite event instead of a system event? I know you can do something like this to create a proper trigger once per instance:
If InstanceVar = 0
Do something and Set InstanceVar to 1
This will always work, but it requires more lines of code, instance variables, and can certainly certain complicate code that is much more complex.
I'm imagining "For Each" is a solution, but everytime I try and use it, it never works like I want it to.
I'm curious of everyone else's thought on this.
Would most certainly use this feature a lot.
Yea, but how would it pick a specific instance from the top tier?
As with all picking, just saying object do foo, makes all, or just the first instance do it.
So basically its the same either way, an extra condition, or an extra action.
newt - If I understand what you're saying, it wouldn't actually need to pick an instance. It would just be nice to say "run this action ONCE while the event above is true" without having complications from multiple instances of 1 object running the same event. Setting an instance variable as a "trigger once" creates the problem of "Ok, now it = 1 so it will only trigger once while it is 0 ... where do I set it back to 0, and when?"
It's not so much a feature as it is a time saver
Develop games in your browser. Powerful, performant & highly capable.
Why not either do this On Object Created and/or On Startup Layout.
If you do it on startup for created objects in the layout then it's done on start up(only once)
For the objects created during play. Then it's on Create so only triggered once.
If it's triggered under other criteria to do this. Then wouldn't that be criteria specific?