Why doesn't this function call work as expected?

0 favourites
  • 3 posts
From the Asset Store
Voice call plugin based on webrtc protocol for construct 3
  • Hi. I'm at a loss here. I have used functions in a similar way before so I'm not sure if I'm missing something here or doing something completely wrong or is this a bug.

    Maybe it just needs some fresh eyes.

    So, version 1 works, the sprite is spawned as expected.

    Version 2 doesn't work, the object is spawned somewhere outside the canvas (0,0 perhaps).

    <img src="http://s13.postimg.org/d21tpt7tz/functionerror.png" border="0" />

    Any ideas?

  • It's cause you use Wait 0.02 with a function parameter/local variable.

    At the moment your create triggers the function has been already over and the function param isn?t given any more. The only ways I know are to use global or instance variables.

    Eg. grand Starry 2 instance variables(functionX, functionY)

    + repeat 7 times

    -- create object starry

    -- set Stary.functionX to Funtion.Param(0)

    -- set Stary.functionY to Funtion.Param(1)

    -- Wait 0,02*loopindex

    -- Set position starry(starry.functionX, starry.functionY)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Genius! I would never have thought of that. Still, I thought function parameters are passed immediately no matter what and stay there, as in normal programming.

    I'll use variables to get around this, thanks!

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