Possible Bug when referencing "In Layout" Objects

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I have run into a rather annoying problem.

    I have a series of objects, which are in the family buildings.

    I run an event so that | on start of layout & for each "buildings" >> add 1 to count_waypoint | this returns 14

    There are absolutely no other references to count_waypoint, and the system only shows 7 objects total for the family "buildings"

    When I switch the target family to another family "buttons_UI" which has 5 objects, count_waypoint returns 5

    I have deduced, by switching the family and switching the objects within the family around, that the problem is only occuring for objects that originally start on the screen.

    all building objects begin in the layout, while buttons_UI is loaded from a different layout.

    ** even weirder... originally this was set up to spawn a waypoint at each building, and set an instance variable (index) to count_waypoint when spawned.

    However the index variables for these waypoints began at 8, so the event was running 7 times (all while adding 1 to counts_waypoint) without spawning a single waypoint. In the end there were 7 waypoints, 7 "buildings", and count_waypoint = 14....

    I have had several other developers look at this, and no one can find the answer. I replicated the events in a separate project and it works fine.

    Anyone know what is going on?

  • Is there a global layer involved ?

    Or global objects ?

    Perhaps make a small example capx with the problem ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try yourfamilyname.Count rather than the for each.

    If it returns 14 then you have 14 objects at that time.

  • I found the problem. I was on start of layout, going to another layout to load Global UI elements. This was causing the initial event to run, then going to the UI layout (destroying the initial objects) and then going back to the game layout and restarting the "on start of layout" event with the global variable maintaining the value from the first event trigger.

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