r102 Breaking Change questions?

0 favourites
  • 5 posts
  • Breaking change: This was actually introduced in an earlier release, but was not changelogged: the way spawned or created objects are picked in subevents has changed. Newly created instances are picked in their own event, but not picked in subsequent "sibling" subevents until the end of the next top-level event. This was done for stability reasons. Post to the forum if you need more information / workarounds.

    Ashley I think this is the one that's breaking my whole game. I don't really understand this change and how to fix my game to work again. Should I create groups or add something to my sub events?

    Everything is working perfectly with r99, so should I maybe stay with that, so I don't destroy anything.

  • You probably should reorganize your events to take the change into account.

    It mostly means that in the event/sub event you're creating/spawning an instance, the newly instance is picked, so the actions are applied to this newly created instance.

    But if you add a sub event to the current event, the newly made instance is not picked anymore as it is not created.

    You should rather end the event there (the top level event) and make a new event, picking the newly made instance (by UID or whatever...).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's easiest to explain with a picture:

    <img src="http://www.scirra.com/images/subeventcreation.png" border="0" />

    Here an object is created in a subevent. (This also applies if an object is spawned using Sprite's 'Spawn an object' action.)

    In the subevent it was created in, the created instance is picked and can be used. It is still picked in subevents underneath that. The green area highlights the area the created instance can be used.

    However, after that, the instance does not really exist, and cannot be used, until the next top level event (the next event which isn't a subevent to anything else). The next green area shows the next top level event when the instance is finally created.

    The area inbetween is subsequent subevents in the same event the object was created. This area is highlighted red, and the instance does not actually exist yet there. So conditions for the sprite placed there will never pick the newly created sprite instance.

    The workaround is to try to do everything in the same event - nest the other events beneath the creating event if possible, so everything is moved up in to the green area.

    It had to be changed this way because it was unstable to allow objects to be used that way, due to particulars in how the engine works. Some people's projects kept crashing and this change fixed them. Admittedly I did not think this would be too big an issue, especially since Construct Classic had always worked the same way. Still, hopefully once everyone adapts their projects to use the new system it will not be a problem any more.

    Edit: another bug is r102 does not count triggers or events in groups as top-level events, which makes it worse. This is fixed in the next build, so it might help fix your project if you use a lot of groups.

  • This does not seem to work for me. If I create a new ball object for example, then use ball.xx in the action of the same or a sub event, it always acts on all balls, not the one I just created.   As I don't know how to pick the event I just created, I actually do this:

    1) have he ball on a special layer, called "templates"

    2) have a blank layer called "new"

    3) create a new "ball" object on layer "new".

    4) use an event condition where I say ball.isOnLayer("new")

    5) then in the events actions, do this: ball.setLayer("target")

    This seems to work.

  • This does not seem to work for me. If I create a new ball object for example, then use ball.xx in the action of the same or a sub event, it always acts on all balls, not the one I just created.   As I don't know how to pick the event I just created, I actually do this:

    1) have he ball on a special layer, called "templates"

    2) have a blank layer called "new"

    3) create a new "ball" object on layer "new".

    4) use an event condition where I say ball.isOnLayer("new")

    5) then in the events actions, do this: ball.setLayer("target")

    This seems to work.

    nutmix: Check this capx example you can effectively notice that only the newly created instance is affected by the "set angle" action. This is how it works.

    If it doesn't work for you, you're doing something wrong so please post a new thread with a capx so we can give you a hand and please stop bumping old threads.

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