Question about performance regarding the event "Always"

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I have a curiosity as how should the events are structured, if it affects the performance :o

    Normally I create events the following way (this is just an example):

    Code
    Upon pressing "F":
    - Create object "square"
    - Set transparency to "64"

    Would it be a big performance hit if I do the following ?

    Code
    Upon pressing "F":
    - Create object "square"
    
    
    Always (or put a condition like If object name = "square")
    - Set transparency to "64"
  • In that case yes because on the first example you set the transparency one time when you press f and create the object. On the second example you set the transparency over and over all the time.

    SUPER MEGA BEST CAT ADVENTURES Please login to see this link. and Please login to see this link. live now!

  • If you don't need an action to be repeated, then there's no reason to have the Always condition attached to it.

    And for the performance question, it all depends on what you're doing. If you're making a small game, it's probably not much of an issue, but with a larger game that has more stuff going on, the little things will eventually add up.

  • Actions like setting a color or transparency or anything you really only need to call once should be done in the same event where they're called in the first place (if you can). If you find for some reason that there's an action that isn't taking with the original action, first check the order of events and make sure that, say, the action on the object isn't being called before the object is created. If all else fails, you can also set a Flag or an Alterable Value on the object, then check for the Flag or Value, use the "Only One Action when Event Loops" function, and call the action there (or use a fast loop). It's an extra line of code, but zero performance hit.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!