How to read array in visual script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Humfred

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?

:bust_in_silhouette: Reply From: vic.the.developer

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.

:bust_in_silhouette: Reply From: jasperbrooks79

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

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

Dosedmonkey | 2021-01-17 11:23