Why doesn't this bit of code work when using this function?

0 favourites
  • 5 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • I have made this function with four parameters, three integers and one string. For some reason, the highlighted code doesn't add the value to the variable. The code block worked before I turned it into a function but it no longer does. I have tried it with different values in the parameter as well.

  • It's the waits.

    The function params are only available on the function call.

  • Got it.

    Is there a different way to delay adding to a variable via a function?

  • No, but you can use the timer behavior to tell the object when to do something.

    Save the value to some temporary data type, variable, dictionary, array, etc.

    Or use another function. Just wait to call it.

    Keep in mind the same rules apply to data there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried a different approach:

    I created a new global boolean initially set to false and a new event that triggers when the variable is true. That event waits and then adds the right amount to the proper variable. The previous function now has a line to set that variable to true when it is called.

    I'm sure there is a more elegant way to do it but it works for me.

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