How do I make sure the game is being executed in the correct order???

0 favourites
  • 2 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello,

    I had a recent issue and posted about it where my layout was getting completed after sprite creation so the global variable I set in the layout was not getting applied to the sprite. You can see my recreation with a small bit of code here drive.google.com/file/d/1LYb92WUw8eW_XANYw1TZfcdS3dDYihx7/view I tried to solve this by using a signal (at the end of the layout) & wait for signal (at the beginning of the "on created" sprite code) which did solve the problem with the variable but created a new one.

    My sprites created with a button push are now messed up. I have the first group of sprites created in the layout section and they are fine. The button push sprites are made after those initially created by the layout. They do not have the "on created" code applied to them. I know that section was working prior to this and I can make it work again by removing the signal and wait which fixed my other problem. I have to think that there is some further issue with the order the sections are being executed in. What can I do to resolve this??

    I could post my file but it is huge . . .

    Thanks for your help and advice.

    Kate

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Triggered events like "On start of layout" or "Object On Created" may be executed in an order different from their order in the event sheet. In your case "On created" is triggered before "On start of layout".

    The easiest solution is to add "Wait 0" action to the beginning of your "On Created" event - this means "wait till the end of tick", and will ensure that the remaining actions will run after all other events in the current tick have finished. You won't need to use signalling, which is not a good solution here.

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