How do I

Get help using Construct 2

Post » Wed May 10, 2017 9:06 pm

hello friends :
how to make ( pick a random instance event ) do what i order for more than one sprite not only one

i made many copies from a sprite and when i set pick random instance to change frame randomly it only do this for one copy how do i get it to do this for many random copies at the same time

thanks in advance :)
B
22
S
8
G
2
Posts: 78
Reputation: 2,701

Post » Wed May 10, 2017 10:12 pm

You can use loop 'repeat' to specify how many times it will picked up random instances.
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226

Post » Thu May 11, 2017 1:39 pm

@alextro i tried this but seems that there is something i'm doing wrong

on start of layout
pick random ( sprite ) instance : ( sprite ) set animation frame to random ( 0,3 )
system repeat 10 times
B
22
S
8
G
2
Posts: 78
Reputation: 2,701

Post » Thu May 11, 2017 1:47 pm

event:
On start of layout
sub event
for each sprite
action
sprite set frame floor(random(0,sprite.AmimationFrameCount))
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu May 11, 2017 7:15 pm

@lennaert whoooho this worked perfectly thank you so much :)
B
22
S
8
G
2
Posts: 78
Reputation: 2,701

Post » Thu May 11, 2017 8:48 pm

You need to put repeat loop before pick random instances to make it works.
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 18 guests