How do I change frame from each instance

Just started using Construct 2? Post your questions here

Post » Mon Dec 19, 2016 2:28 pm

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:

Code: Select all
Repeat numTimes
> Pick all Sprite
> For each Sprite order by Sprite.UID ascending
> Sprite AnimationFrame > 0 : Sprite Set AnimationFrame = Sprite.AnimationFrame+1
B
4
S
2
Posts: 136
Reputation: 874

Post » Mon Dec 19, 2016 2:31 pm

Braus we will need more info. Maybe post your capX or a demo capX reproducing your issue.
GMO FOOD = DEATH
B
23
S
9
G
5
Posts: 567
Reputation: 6,378

Post » Mon Dec 19, 2016 3:06 pm

It's just a small part of the game. I got a print.

Image
B
4
S
2
Posts: 136
Reputation: 874

Post » Mon Dec 19, 2016 3:31 pm

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.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Mon Dec 19, 2016 4:19 pm

blackhornet wrote: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.
B
4
S
2
Posts: 136
Reputation: 874

Post » Mon Dec 19, 2016 4:28 pm

"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.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Mon Dec 19, 2016 4:34 pm

blackhornet wrote:"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?
B
4
S
2
Posts: 136
Reputation: 874

Post » Mon Dec 19, 2016 4:43 pm

The ordering is unnecessary, unless each progresses one at a time, which is another problem.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Mon Dec 19, 2016 5:33 pm

blackhornet wrote: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?
B
4
S
2
Posts: 136
Reputation: 874

Post » Mon Dec 19, 2016 5:40 pm

It would be easier if you could post a CAPX.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron