- Edited
I'm trying to follow along with an Udemy Godot video and I've become lost. Making a simple word game that asks the player for a name, a noun, an adverb and an adjective. I'm using arrays in dictionaries, the previous lesson each variable was separate but now we've combined them into one using a Dictionary. My game ran fine until I did this and I'm getting the above error. The debugger isn't really telling me anything (that I can understand). Here's my script:
extends Control
var player_words = []
var current_story = {
"prompts" : ["A name", "A noun", "An adverb", "An adjective"],
"story" : "Once upon a time someone called %s ate a %s flavored sandwich made him feel all %s inside It was a &s day"
}
onready var PlayerText = $VBoxContainer/HBoxContainer/PlayerText
onready var DisplayText =$VBoxContainer/DisplayText
func _ready():
DisplayText.text = "Hello and welcome to a word game. "
check_player_words_length()
PlayerText.grab_focus()
func _on_PlayerText_text_entered(new_text):
add_to_player_words()
func _on_TextureButton_pressed():
if is_story_done():
get_tree().reload_current_scene()
else:
add_to_player_words()
func add_to_player_words():
player_words.append(PlayerText.text)
DisplayText.text = ""
PlayerText.clear()
check_player_words_length()
func is_story_done():
return player_words.size() == current_story.prompts.size()
func check_player_words_length():
if is_story_done():
end_game()
else:
prompt_player()
func tell_story():
DisplayText.text = current_story.story % player_words
func prompt_player():
DisplayText.text += "May I have " + current_story.prompts[player_words.size()] + " please?"
func end_game():
PlayerText.queue_free()
$VBoxContainer/HBoxContainer/Label.text = "Again!"
tell_story()
It goes through all the prompts then crashes after my input for the adjective. It ran fine until I changed the variables into one. Everything looks identical to what the author has, the only thing I can think of is that I'm on a later version of the engine, 3.2. I think the author is on 3.1. Is that the issue?