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

Hello!
I'm making a 2D Tower Defence game off of Game Development Center's tutorial series:
https://www.youtube.com/watch?v=JBQgmy3Oiw4&list=PLZ-54sd-DMAJltIzTtZ6ZhC-9hkqYXyp6&index=7 (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()
yield(get
tree().createtimer(0.2),"timeout")
spawn
enemies(wave_data)

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

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

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.