How do I optimize /save events to enable/disable FX

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • This code actually works and do what i want, simply to know if there is another way to do it more simple.

    I have an Slider, and for each value i assign to enable a FX on a sprite but i want the other gets disable when the value is not their one.

    So the solution is when other is selected create a function that is called at the starts disabling all efects, and then enable the selected one.

    Any other way to solve it or the actual aproach is ok? There are lots of Blend FX, live about 20, so before do all i want to be sure this is the correct way in case is wrong and i have to build again all the FX system.

  • If only one effect can be active at a time, then your approach is ok. I would've done it the same way.

    I think you can optimize it by changing your event 104 to "SliderBar On Changed", then you will be able to move "Call FxOff()" to this event 104 and remove it from all sub-events. Also you could remove all "Trigger once" conditions.

    You can also make a file (CSV or XML) with the list of values, corresponding effects and their names, then load this data into a dictionary etc.. But for 20 effects this would probably be an overkill.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I see, Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)