How do I use the return value of a function?

0 favourites
  • 3 posts
From the Asset Store
Platform HTML5 game, where the little Dinosaur must cross the forest, desert and snow forest.
  • Hi,

    can anyone help me to understand, how to use "set return value" and then "if function return value is"?

    I don't exactly get, how that works. is it like a waiting state? I imagined, you can call a function, an then use the return value in the following code, (like await signal or as a variable) but that does not seem work the way I thought at least. I also don't understand, how the code knows, which functions return value I mean and so on... I'm quite sure it is easy, but sometimes your mind takes a wrong twist.

    I could not find any lecture on that, please give me a link or some advice or an example.

    Thanks in advance!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So say you have a function like this:

    On Function "isXEqual1" (X): -- A function called 'isXEqual1' which takes a parameter of X

    if X = 1:

    set return value: true

    else

    set return value: false

    now you can call this function using Function.Call("isXEqual1", X) which will return true if X = 1 or false if not.

  • briggybros: Thanks, that part was clear though. Now I tried to make a demo of my actual problem (USING the return value), and figured out, it does work just fine the way I thought... I might have had a mistake somewhere, when I originally intended to use this mechanism.

    Thanks a lot for your support, your reply was very constructive, as it made me rethink the whole issue.

    Untwisted!

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