How do I set random animation?

Get help using Construct 2

Post » Sat Feb 20, 2016 8:20 am

There is an object in me project that has 2 animations. And it creates every x seconds with animation 1(default). But I need this object was created with random (1 or 2) animation. Is it possible to set random animation on creation of an object?
B
5
Posts: 23
Reputation: 275

Post » Sat Feb 20, 2016 8:36 am

serega990306 wrote:There is an object in me project that has 2 animations. And it creates every x seconds with animation 1(default). But I need this object was created with random (1 or 2) animation. Is it possible to set random animation on creation of an object?


Yes it is possible to set a random animation on object creation.

*Every X Seconds
--->Create "Sprite1" at (X,Y)
--->Set Sprite.AnimationName to choose("Animation1", "Animation2")

--------------------------------------------------------------------------------------------------------
I used the expression "choose", it will choose the animation written inside the parenthesis.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
64
S
18
G
90
Posts: 1,118
Reputation: 59,565

Post » Sat Feb 20, 2016 11:34 am

chadorireborn wrote: --->Set Sprite.AnimationName to choose("Animation1", "Animation2")

I think I'm an idiot becouse I can't understand what I should write:
System - Every X seconds ->
System - Create Sprite1 at (x,y)
Sprite1 - Set animation (HERE)
B
5
Posts: 23
Reputation: 275

Post » Sat Feb 20, 2016 12:20 pm

like this:

Image

In this example you spawn a Sprite every 2 seconds randomly between x=840 and y=480 with one of the animation: animation1 or animation2 from Sprite.
B
24
S
3
G
1
Posts: 451
Reputation: 2,165


Return to How do I....?

Who is online

Users browsing this forum: rayolf, Yahoo [Bot] and 9 guests