This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I'm making a 2D Tower Defence game off of Game Development Center's tutorial series: (This is part four, which is the part I'm up to)
And I've had a few errors, but I figured most of them out, except this:


Wave Functions


func startnextwave():
var wavedata = retreivewavedata()

func retreivewavedata():
var wavedata = [["BlueTank"], 0.7, ["BlueTank", 0.1]]
wave += 1
enemiesinwave = wavedata.size()
return wave

func spawnenemies(wavedata):
for i in wavedata:
var new
enemy = load("res://Scenes/Enemies/" + i[0] + ".tscn").instance()
mapnode.getnode("Path").addchild(newenemy, true)

And every time I try to run the actual game it says:
Invalid get index '1' (on base: 'Array').

Any ideas why is says this error? I can give more info if necesary. :)

Godot version 3.5.1.stable
in Engine by (57 points)

1 Answer

0 votes
Best answer

Haha, my problem was just I got the list wrong:
var wavedata = [["BlueTank"] <--- (Here's where it's wrong), 0.7, ["BlueTank", 0.1]]
It was just meant to have the closing bracket after the 0.7.
Thanks for, well... nothing. I just made a silly mistake.

by (57 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 Frequently asked questions and 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 [email protected] with your username.