How do I create random frame.

Get help using Construct 2

Post » Mon Jan 02, 2017 4:32 pm

Hello guys,

I have an issue when i try to create a sprite with random frame.

so first i create the object and then i use sprite set animation frame to random(1)

I tried with random(0) also with random(0,1) and i cant create sprites with random frame.

Anyone can please help me?

Thanks and regards.
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Mon Jan 02, 2017 4:36 pm

int(random(2)) will give you 0 or 1.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Mon Jan 02, 2017 5:31 pm

int(random(animationframecount+1)) as blackhonet said, or use round or floor (random(0,animationframecount)) will cut the .3231321 digits after the full number
B
76
S
22
G
69
Posts: 1,353
Reputation: 43,833

Post » Mon Jan 02, 2017 5:39 pm

OMG dude, you are my hero, thanks a lot.
B
31
S
13
G
6
Posts: 355
Reputation: 5,058


Return to How do I....?

Who is online

Users browsing this forum: kalibark2 and 26 guests