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
5
Posts: 355
Reputation: 4,558

Post » Mon Jan 02, 2017 4:36 pm

int(random(2)) will give you 0 or 1.
ImageImageImage
B
71
S
21
G
220
Posts: 3,648
Reputation: 123,725

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
70
S
20
G
67
Posts: 1,313
Reputation: 42,299

Post » Mon Jan 02, 2017 5:39 pm

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


Return to How do I....?

Who is online

Users browsing this forum: htmlgames and 4 guests