How do I change frame from each instance

0 favourites
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • I have 50 instances and I need to get some instances and change the frame of them one by one. I am trying to do this using the UID number but it is not working.

    My pseudo-code:

    Repeat numTimes
    

    Pick all Sprite

    For each Sprite order by Sprite.UID ascending

    Sprite AnimationFrame > 0 : Sprite Set AnimationFrame = Sprite.AnimationFrame+1[/code:1wgblp3w]

  • Braus we will need more info. Maybe post your capX or a demo capX reproducing your issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's just a small part of the game. I got a print.

  • The repeat won't work. It's going to run that in one tick, so you'll never see the result. You'll need a timer to simulate the animation running, or turn on the animation, with something else to stop each after 9 frames.

  • The repeat won't work. It's going to run that in one tick, so you'll never see the result. You'll need a timer to simulate the animation running, or turn on the animation, with something else to stop each after 9 frames.

    Hey blackhornet

    Why the "repeat" event is not work?

    I need to change the frame of each one of the instances per time. I really need a timer and I thought that the "repeat" would do this, or in other words: pick all the instances with non-zero frame and create an order using the UID number and then change the frame of each one at a time.

  • "per time" is the critical point. "Repeat" will do it in one tick, that is all within 1/60 of a second. You need to delay each frame change or you won't see the progression, it will just jump 9 frames.

  • "per time" is the critical point. "Repeat" will do it in one tick, that is all within 1/60 of a second. You need to delay each frame change or you won't see the progression, it will just jump 9 frames.

    Ok. So the rest of the code is right?

  • The ordering is unnecessary, unless each progresses one at a time, which is another problem.

  • The ordering is unnecessary, unless each progresses one at a time, which is another problem.

    It's not working. Could you please change my pseudo-code to me understand how can I implement it?

  • It would be easier if you could post a CAPX.

  • Hey blackhornet

    Actually, I need that each instance changes its frame once and one instance per time. For example: 1st = UID0 > change frame (wait 2 sec) / 2nd = UID1 > change frame / (wait 2 sec) / and so on. Can I change your code to get it in this way? Thanks for your help.

  • I have 50 instances and I need to get some instances and change the frame of them one by one. I am trying to do this using the UID number but it is not working.

    My pseudo-code:

    Repeat numTimes
    > Pick all Sprite
    > For each Sprite order by Sprite.UID ascending
    > Sprite AnimationFrame > 0 : Sprite Set AnimationFrame = Sprite.AnimationFrame+1[/code:32k9refy]
    

    try using IID - its the numeration of objects that are part of same type. while uid - is numeration of objects all placed in screen (if you have other objects placed your objects you pick wold not have a incremental order like from 1,2,3,4,5,6,7,8,9 but more like sprite uid 1,2,6,12,13,14, etc)

  • > I have 50 instances and I need to get some instances and change the frame of them one by one. I am trying to do this using the UID number but it is not working.

    >

    > My pseudo-code:

    >

    >

    Repeat numTimes
    > > Pick all Sprite
    > > For each Sprite order by Sprite.UID ascending
    > > Sprite AnimationFrame > 0 : Sprite Set AnimationFrame = Sprite.AnimationFrame+1[/code:2oirrxxn]
    > 
    
    try using IID - its the numeration of objects that are part of same type.  while uid - is numeration of objects all placed in screen (if you have other objects placed your objects you pick wold not have a incremental order like from 1,2,3,4,5,6,7,8,9 but more like sprite uid 1,2,6,12,13,14, etc)
    

    Hey GCS

    I think it's not the problem I am having. Maybe the UID is not the issue. But I don;t know what I need to do to get this working. It is the smaller part of the game and I cannot solve it. I will be grateful if you can try to change my pseudo-code to try to help me to figure out this feature.

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