+1 vote

The idea is simple, I want the animation player to play random animation. The animation name prints out ok, but the animation is not playing. Any thing wrong in my code below? Thank you.

func play_random_animation():
    var list = [“Name01", “Name02"]
    list.shuffle()
    var animationName = list[0]
    $animationPlayer.play(animationName)
Godot version v3.3
in Engine by (244 points)

have you created the animations

Yes, both animation plays fine individually. However, it just won't play with the function after shuffle, not sure why.

when are you calling this function? Also I am going to do this live on stream in 10 minutes here: https://www.youtube.com/watch?v=fFQLwxayunI

1 Answer

0 votes

Answering your Question LIVE on YouTube: https://www.youtube.com/watch?v=fFQLwxayunI

by (577 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.