Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | torohaifisch |
Hello everyone i am using this dictionary
var enemy_dict= {
1:"res://modo_pelea/escenas/enemigos/enemy_test/enemy.tscn"}
in this function
func spawn_enemy(enemy):
ene= load(enemy_dict[enemy])
var enemigo=ene.instance()
add_child(enemigo)
so spawn enemy gets its value from the x component of a vector2 lets say it is setup
(i am setting up the array using the inspector) as in this image Imgur: The magic of the Internet
the problem is when i do spawn_enemy(vect.x) it throws this error:
Invalid get index ‘1’ (on base dictionary)
can anyone explain me what am i doing wrong?