Pick All / Create Bug

0 favourites
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Problem Description

    Created objects aren't picked.

    Attach a Capx

    https://1drv.ms/u/s!AhHSZHEulqh_gTlThpxipQKQXDNY

    Description of Capx

    Created objects, and tries to pick them all, then rotate them all

    Steps to Reproduce Bug

    • run and see which objects are rotated

    Observed Result

    Only one Sprite is rotated.

    Expected Result

    All Sprites should be rotated.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    vista sp2

    Construct 2 Version ID

    r227

  • It is not a bug. New created instances will not be put into SOL until next tick.

    Add system: wait 0 after system: create , then you can pick all instances.

  • They'll be put in the SOL before the next tick. It can be picked in the next top level event.

  • When you create an object, that object immediately gets picked. If it can be picked immediately after creation, why can't it be picked at any other time?

  • There are three lists internally:

    Instance list

    New list

    Sol list

    By default the sol list will be the instance list, which you then filter. When you create an object it's added to the new list and the sol is set to it. The pick all sets the sol to the instance list and since the new list isn't added yet those objects aren't picked. Then at the next "top level" event the new list is merged into the instance list.

    You can search the forum for "top level" for some more discussions/explanations of this. In one of the change logs had a fix where before "pick all" would pick the new ones too. This was fixed to prevent cases of infinite loops.

    Alternatively the pick by uid can pick objects from the new list. It's the exception to the rule.

  • That's weird. Why change that to prevent infinite loops? Users can still create infinite loops. If it was possible for pick all to include new objects, that makes more sense to keep it that way than to have it not pick them.

    I want to know the reason against it.

  • The version this was changed:

    https://www.scirra.com/construct2/releases/r102

    A discussion about it with input from ashley:

    r102-breaking-change-questions_t73647

  • That doesn't explain why you can't use Pick All as another sub-event inside the created objects event to include the new objects.

    If the issue was new objects being included in events outside the sub-event (the sibling sub-events), then shouldn't it be alright to include the new objects in the nested sub-events ?

  • I had a similar problem calling a function which sorts zOrder after an object was created. The function would sort everything except the created sprite, even though the function picked all. Function is top level event, bug or by design?

    On colission

    -> Create Sprite

    -> call function

    function picks all. sorts z-order.

    did not work. the newly created object is not sorted with the rest.

    On created (new top level event)

    -> call function

    function picks all. sorts z-order.

    did not work. the newly created object is not sorted with the rest.

    I can't get the created sprite to sort with the rest of the objects, even after calling a function.

    wait 0 works but creates ugly unsorted graphics glitch for a fraction of a secondbefore it's sorted correctly.

  • Yes, I noticed that too in my attempt to find a solution to the problem. Functions don't seem to act like top-level events, so they can't select the newly creates objects.

    In many cases, using a Wait is not an option, as it disrupts the flow of the program, causing things to become unsynchronized. You then have to create more variables/etc and methods to check when to do things.

    If you could pick the newly created objects (perhaps only in the nested sub-events?), it would solve these problems and help make the events simpler/cleaner.

  • I had a similar problem calling a function which sorts zOrder after an object was created. The function would sort everything except the created sprite, even though the function picked all. Function is top level event, bug or by design?

    On colission

    -> Create Sprite

    -> call function

    function picks all. sorts z-order.

    did not work. the newly created object is not sorted with the rest.

    On created (new top level event)

    -> call function

    function picks all. sorts z-order.

    did not work. the newly created object is not sorted with the rest.

    I can't get the created sprite to sort with the rest of the objects, even after calling a function.

    wait 0 works but creates ugly unsorted graphics glitch for a fraction of a secondbefore it's sorted correctly.

    Can you find the correct z before the creation and place it then?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The function is called b4 the merging.

    Just use the trigger 'On created'.

  • The function is called b4 the merging.

    Just use the trigger 'On created'.

    If i put on created as a new top level event below it still doesn't work. Maybe if i put on created above? Does the merging happen at the end of the event sheet?

    On created >

    On collision with Sprite2 > Create Sprite

    Run through event sheet - back to top.

  • I have no idea what that means. It works this way ....

    Some conditon ...

    The create action .....

    New condition 'on created' ....

    Conditions + actions

    The 'on created' picks the newly created object, when it is ready to pick. And then you do with it what you like.

    The 'on created' is a trigger, it does not matter where in the events you put it, as long as it is a root event.

    If this gives you a picking problem (kinda impossible) then you have to be very specific on what you mean with "it still doesn't work". Show the events.

  • I have no idea what that means. It works this way ....

    Some conditon ...

    The create action .....

    New condition 'on created' ....

    Conditions + actions

    The 'on created' picks the newly created object, when it is ready to pick. And then you do with it what you like.

    The 'on created' is a trigger, it does not matter where in the events you put it, as long as it is a root event.

    If this gives you a picking problem (kinda impossible) then you have to be very specific on what you mean with "it still doesn't work". Show the events.

    It most certainly does not work. Everything is picked except the newly created one despite called by a top level event.

    Even if i set the opacity directly in the "on created" everything except the created sprite has the opacity set to 50.

    It seems like the newly created arrowInGround is not in the family upon creation.

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