How do I spawn the same sprite randomly with another size

Get help using Construct 2

Post » Mon Dec 22, 2014 6:15 am

hi guys...How do I spawn the same sprite randomly with another size and randomly rotated ?

thanks :)
B
38
S
16
G
2
Posts: 463
Reputation: 4,922

Post » Mon Dec 22, 2014 6:22 am

Just add a set size and rotation action right after spawning, it'll only affect that instance.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Mon Dec 22, 2014 7:43 am

hi thanks...but I need random sizes...one time big than medium or very small...same 4 the rotation...how can i do that ?....thanks...
B
38
S
16
G
2
Posts: 463
Reputation: 4,922

Post » Mon Dec 22, 2014 7:58 am

Just use the random expression in size and angle, excerpt from manual:

random(x)
Generate a random float from 0 to x, not including x. E.g. random(4) can generate 0, 2.5, 3.29293, but not 4. Use floor(random(4)) to generate just the whole numbers 0, 1, 2, 3.

random(a, b)
Generate a random float between a and b, including a but not including b.


So for the angle you can put random(360), for the size - if you want a proportional size you would do something like:

Set Sprite width to random(16,32)
Set height to Sprite.width
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Mon Dec 22, 2014 8:49 am

thanks a lot:)
B
38
S
16
G
2
Posts: 463
Reputation: 4,922


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 30 guests