How do I PICK RANDOM ANIMATION?

Get help using Construct 2

Post » Thu May 11, 2017 2:12 pm

I created a SPRITE. In it I have different ANIMATIONS: Animation1, Animation2, - different frames - etc.

I would like to:

Bullet OnCollision with SPRITE > Play Animations (contained in ITEM) Randomly.

I don't know if that's clear but the fact of the matter is: I already have this going like SET ANIMATION TO ("Animation1, Animation2, Animation3")

I tried quoting animations individually and all but it still aint working.

HELP :)
B
19
S
4
G
2
Posts: 97
Reputation: 2,244

Post » Thu May 11, 2017 2:20 pm

kiko2015 wrote:I created a SPRITE. In it I have different ANIMATIONS: Animation1, Animation2, - different frames - etc.

I would like to:

Bullet OnCollision with SPRITE > Play Animations (contained in ITEM) Randomly.

I don't know if that's clear but the fact of the matter is: I already have this going like SET ANIMATION TO ("Animation1, Animation2, Animation3")

I tried quoting animations individually and all but it still aint working.

HELP :)


Use the choose() function.

choose("Animation1", "Animation2", "Animation3")
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
65
S
21
G
90
Posts: 1,124
Reputation: 59,852

Post » Thu May 11, 2017 4:19 pm

chadorireborn wrote:
kiko2015 wrote:I created a SPRITE. In it I have different ANIMATIONS: Animation1, Animation2, - different frames - etc.

I would like to:

Bullet OnCollision with SPRITE > Play Animations (contained in ITEM) Randomly.

I don't know if that's clear but the fact of the matter is: I already have this going like SET ANIMATION TO ("Animation1, Animation2, Animation3")

I tried quoting animations individually and all but it still aint working.

HELP :)



Use the choose() function.

choose("Animation1", "Animation2", "Animation3")



Is this the simpliest way?
B
19
S
4
G
2
Posts: 97
Reputation: 2,244

Post » Thu May 11, 2017 4:21 pm

@Kiko2015 What I would do is have a variable for the random animation then in the event sheet have each animation set to a number on a viable then you just change the variable to a random number.
Image
B
24
S
13
G
12
Posts: 290
Reputation: 9,275

Post » Thu May 11, 2017 5:04 pm

try

Image

Sprite set animation
Code: Select all
"Animation"&str(int(random(8))+1)
B
66
S
24
G
7
Posts: 1,513
Reputation: 11,037

Post » Fri May 12, 2017 2:59 am

LaurenceBedford wrote:@Kiko2015 What I would do is have a variable for the random animation then in the event sheet have each animation set to a number on a viable then you just change the variable to a random number.



Thank you. Unfortunately, none of the answers helped me. But I ould like to know if we have exchanged emails before. I cant find your email. I would like to help ypu.
B
19
S
4
G
2
Posts: 97
Reputation: 2,244

Post » Fri May 12, 2017 6:07 am

@Kiko2015 Sorry for that you are correct the email is wrong here's the right email address [email protected] .com
Image
B
24
S
13
G
12
Posts: 290
Reputation: 9,275

Post » Fri May 12, 2017 10:03 am

You could try this , under set animation

I have used this before, it works.

tokenat("animation1|animation2|animation3|animation4|animation5|animation6", int(random(6)),"|")


Of course @Anonnymitet has the Easiest method with Choose
Last edited by sizcoz on Fri May 12, 2017 11:00 am, edited 1 time in total.
Bushy Ball\Boatman Bill\Sticky Web\Snake

Image ImageImageImage

During the gold rush it was a good time to be in the pick and shovel business
B
46
S
14
Posts: 252
Reputation: 5,352

Post » Fri May 12, 2017 10:18 am

I don't understand how the above answers could not help you? That is exactly how you do it.

on bullet collision with player --> set animation to --> choose("animation1","animation2","animation3")

Remember to add "" around every animation name like the example above.

So in the text field on the play animation action you write exactly this:

Code: Select all
choose("animation1","animation2","animation3")


Except change the name of the animations to the ones you want to use
B
55
S
24
G
13
Posts: 763
Reputation: 12,567

Post » Sun May 14, 2017 6:04 am

Anonnymitet wrote:I don't understand how the above answers could not help you? That is exactly how you do it.

on bullet collision with player --> set animation to --> choose("animation1","animation2","animation3")

Remember to add "" around every animation name like the example above.

So in the text field on the play animation action you write exactly this:

Code: Select all
choose("animation1","animation2","animation3")


Except change the name of the animations to the ones you want to use


Thank you. It DOES work, Myy bad!!!! Thank you so much!!!

:)
B
19
S
4
G
2
Posts: 97
Reputation: 2,244


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, Yahoo [Bot] and 29 guests