How many different instances I can pick in one event?

0 favourites
  • 9 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi,

    Having a bit of a problem with my event's and I'm not sure if picking instance of object A and picking Instance of Object B in same events condition works or not? So how many different instances of different objects I can pick in single condition?

    Also is this valuable as trigger, cause it doesn't seam to work for all Objects A, only for the one that got triggered:

    -Object A on trigger

    -- Object A Boo1 = 1, for each Object A, Object A Boo1 = 1, Pick Object B by Object A. Variable

    Thanks

  • It's hard to know exactly what you want here, but you don't really need "for each Object A, Object A Boo1 = 1" as only the triggered A objects are picked in the trigger anyway, So just picking B by VarA should work, or at worst, you need a For each A, then pick B by A.

    Object A on trigger

    -- for each Object A, Pick Object B by Object A. Variable

    OR if you are adding to the list of "A"s by setting the Bool, then you need a Pick All A to get all of them before the For each that you have. Again, hard to know what you really want from the pseudo-code.

  • megatronx

    I am not aware of any limit in how many instances can be picked in a single condition.

    The "For Each Object A" will only loop through the instances that were triggered in the parent event. If you wanted to process all instances you would need to add a "Pick All Object A" line before the loop to clear the filter applied by the trigger event.

    There should be no problem also picking instances of Object B. The only time I have had trouble is if you just created new instances. Those can't be picked outside of the scope where there were created until the next top level event.

  • Yes, I want to go trough all instances and then pick those with Boo = 1 and then if boo = 1 pick objects B by objects A variable. So I got to do Pick All then for each and then do IF. I'l try that.

  • capx will be easier....but when it comes to picking instances I like using functions to encapsulate things. It reduces complexity.

  • why would you do that?

    example - you have these 3 sprites - walls, enemies, player. you have 10 instances of walls, 5 of enemies, 1 of player.

    why would you pick each of these instances (including walls) which have var boo ? why would wall even need to be picked ? (in example where you want to check all enemies and yourself)

    best would be to use family if you really want all instances, but that family will contain every sprite. it seems wrong whatever you are doing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • why would you do that?

    example - you have these 3 sprites - walls, enemies, player. you have 10 instances of walls, 5 of enemies, 1 of player.

    why would you pick each of these instances (including walls) which have var boo ? why would wall even need to be picked ? (in example where you want to check all enemies and yourself)

    best would be to use family if you really want all instances, but that family will contain every sprite. it seems wrong whatever you are doing

    On Object B tween ended I need to compare if a string created from several "keys" sent out from several Object's A and received by By object C match required "Key" of Object C. If not, all objects B got to return to their original position via tween, Objects A and Object C got to reset their state. So I need to pick all Objects A within a group, set trough group variable and change their boos and their variables. Basically a switch puzzles that differ depending on their variables. Sometime spuzzle is: switch in correct order, other time, press those leave others, and yet another time it press all, or add item.

  • I suppose the 'string' is an instance variable in object C, and that there is only one object C. If there are more instances of object C, you have to explain wich instance of object C must be picked.

    I suppose the string is made and present.

    Then (under those circumstances) ....

    Trigger for Instance of Object B's tween ended ... sets that that object picked.

    There is only 1 instance of object C .. so it does not need picking.

    In a sub, evaluate the instance variable of Object C with the string in Object B.

    If not true, reset B, it does not need picking.

    For the others the easyst thing is to use a Function. Because Functions start picking from scratch.

    So, if the evaluating condtion is not true, ....

    call a function 'send all B back". In that on function you dont need to pick, just the action to send B back. (when not picked, actions adress all B's)

    call a function 'reset all A". In that on function you dont need to pick, just reset A (when not picked it resets all A)

    Hope that is clear.

  • "-Object A on trigger

    -- Object A Boo1 = 1, for each Object A, Object A Boo1 = 1, Pick Object B by Object A. Variable"

    a Pick all instances would be needed before checking if boo is equal to one if you want to apply it to all objects, unless I did not understood fully

    https://www.scirra.com/manual/124/system-conditions

    Must admit I didn't understood exactly what you wanted to do though so I may be irrelevant

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