0 votes

Hi,
I'm trying to learn Godot with this tutorial: http://docs.godotengine.org/en/latest/getting_started/step_by_step/your_first_game.html but with visual script.

For the part "Enemy scene", i need to read an array ($AnimatedSprite.animation = mob_types[randi() % mob_types.size()]) and i have no idea how to do a simple var = array[0] !

Any help?

in Engine by (12 points)

2 Answers

0 votes

From available nodes, use Expression. Set it to have 1 argument, pass in the array, and then type in a[0] and pass that one to where you need it.

by (113 points)
0 votes

you need ' get index ' box, first variable is index 0, 2nd is 1, integers <3

by (98 points)

Can you explain this better? I find three different get index boxes and none seem to make sense. Thank you.

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.