How do I use a function corretly

  • Hi Folks, i have a simple function which should update the position of a object.

    However, if i call the funtion after the object is created it does not update the position. When i and an 1 Tick delay it does.

    Can somebody explain this to me please?

    Does not work:

    Does Work:

    Kind regards

    Patrick

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Newly created objects are inaccessible outside of the event they were created in until the next tick. Two more things to note just in case you're not aware (just some useful info):

    1. A wait time of 0 seconds will wait until the next frame.

    2. Functions don't remember objects picked by the event from which they were called. If you want the function to work with a specific object, you'll have to pass in your object's UID as a parameter and pick it inside the function.

  • WOW, that was a fast answer, thank you very much!

    Havent found anything about this in the manual, but i could imagine its something like that hopefully i am not just blind haha

    1) -> Perfect

    2) Thats a very usefull information, even if this is not the case here it will help in the future!

    Kind regards

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