How do I do actions on created objects in order ?

  • Hi , I'm trying to move blocks by touching right and left like shown below

    but there's a little problem :

    sometimes blocks in different rows move toghether though i just want them to move one by one

    its hours im searching forum to check how to move them by UID or IID sequence , nothing found.

    tnx for your time

  • Without seeing your even sheet or capx file I would guess it has something to do with multiple instances of the same sprite.

    A totally blind guess would be to assume you are dropping the red block through the gaps in the white ones. If so, try making the white ones different sprites and deciding which to move based on the position (Y value) of the red block.

    Is that making any sense?

  • Without seeing your even sheet or capx file I would guess it has something to do with multiple instances of the same sprite.

    A totally blind guess would be to assume you are dropping the red block through the gaps in the white ones. If so, try making the white ones different sprites and deciding which to move based on the position (Y value) of the red block.

    Is that making any sense?

    Hi , thanks for help

    Yes I'm trying to move the red one through the gaps.

    As you can see in my event sheet I'm trying to make two groups of white rectangles, leftblock and left block 2 (cause there will be no more than two blocks on the layout at the same time) ,and the right blocks are positioned to them every thick. now I'm just trying to spawn the groups one after another to see if it works.

    This is the original game : gameeapp.com/game/yKaQa9ti

  • Assuming they are created with default lock=0 then it makes sense that there would be multiple on screen that fulfil lock=0 criteria and can be moved. You need to define only one set of blocks that can be moved at a time with a unique variable or bool, then once moved you change this and set the next lot of blocks to active. At the moment it looks like you are relying on luck as the blocks move toward the player. if you wanted to really lock it down you could increment a variable and pass it through a function that relates to the block IID. So the block IID must match the variable to be available to move, then you increment the variable and the next set of blocks become available. Block IID wouldn't work though if you are destroying the blocks as they go off screen, so you could just make use of an object instance variable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Assuming they are created with default lock=0 then it makes sense that there would be multiple on screen that fulfil lock=0 criteria and can be moved. You need to define only one set of blocks that can be moved at a time with a unique variable or bool, then once moved you change this and set the next lot of blocks to active. At the moment it looks like you are relying on luck as the blocks move toward the player. if you wanted to really lock it down you could increment a variable and pass it through a function that relates to the block IID. So the block IID must match the variable to be available to move, then you increment the variable and the next set of blocks become available. Block IID wouldn't work though if you are destroying the blocks as they go off screen, so you could just make use of an object instance variable.

    Thanks for help , I'm going to test that idea right now.

    Actually I am destroying them to save memory cause there will be too many of them after few minutes.

  • Without seeing your even sheet or capx file I would guess it has something to do with multiple instances of the same sprite.

    A totally blind guess would be to assume you are dropping the red block through the gaps in the white ones. If so, try making the white ones different sprites and deciding which to move based on the position (Y value) of the red block.

    Is that making any sense?

    That worked ! Thank again for your time.

    But still I think picking specific object instances is an issue for people like me, I was digging the forum and I couldn't find any clear answer, doing actions on object Instances in specific order is still a problem for me and maybe some other people.

  • Yep that's the idea. The system pick actions are there to pick by certain criteria. The common one is IID because it will be the create order of that object type, of course you are blocked by using the destroy action which starts to change the IID so an instance variable for the object that increments 'on created' will also work as a kind of ID system.

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