At least, I think thats what the problem is. I'm not exactly sure how to describe it.
What I'm trying to do here is create a simple point and click where a cutscene plays each time you click something. I have a script called "globals" containing variables and functions to get them. These variables are: stage, progress, and animon.
"stage" and "progress" are self explanatory. "animon" is a boolean, which is there so that I can tell if an animation (cutscene) is playing or not.
Here is my script for the button:
extends Control
onready var animplayer = get_node("../../../AnimationPlayer")
func _input_event(ev):
if (ev.type==InputEvent.MOUSE_BUTTON and ev.button_index==BUTTON_LEFT and ev.pressed and get_node("/root/globals").getAnimon() == false):
if(get_node("/root/globals").getStage() == 1):
if(get_node("/root/globals").getProgress() == 0):
animplayer.connect("finished", get_node("/root/globals"), "setAnimon", [false])
animplayer.play("Cutscene 2")
get_node("/root/globals").setProgress(1)
elif(get_node("root/globals").getProgress() == 1):
animplayer.connect("finished", get_node("/root/globals"), "setAnimon", [false])
animplayer.play("Cutscene 3")
get_node("/root/globals").setProgress(2)
func _ready():
pass
This throws the following error when I click the button:
Attempt to call function 'getProgress' in base 'null instance' on a null instance.
Its most likely a simple mistake. Thanks for any help that I get!