How do I get construct to actually register objects created in the previous sub-event?

0 favourites
  • 3 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Trying to figure out why this doesn't work as expected. Basically, I've got a right click event with a sub event that spawns objects based on an array contents then a second sub event after that which tries to count/manipulate those newly created objects. However Construct doesn't seem to be aware that those objects exist until after the entire event and all sub events have fired. And even then it can mess up counts.

    See this project for a demo.

    onedrive.live.com/redir

    In the demo right click on the screen and it will spawn 5 boxes. There is a text field that is supposed to display how many boxes there are just after they are created but it says 0. Additionally, the directive after that to change the box sizes doesn't work because it doesn't think there are any boxes. Then if you right click again it thinks there are 10 boxes where there are only 5 and the size directive still doesn't fire.

    Any insight here would be appreciated.

    I'm using r268

  • It's a known issue, check comments here:

    github.com/Scirra/Construct-bugs/issues/5178

    The easiest workaround is to add "Wait 0" before accessing newly created instances.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • According to that thread it's a feature not a bug. Oh well, workaround works great thanks!

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