Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Destroyer2000 |
So, I’m having troubles with interactions. Basically, I’m trying to figure out how to have a dialogue box appear when the play is in an area 2D while also having pressed a button (in this case it’s enter).
And while I did have it so that the game would crash when you did this, it no longer does.
Also to note, in case this is important, I have the code in the Area2D code. Thought I should point that out.
extends Area2D
var inarea = false
export var text = ["A broken Cart."]
func _ready():
if inarea == true:
if (Input.is_action_just_pressed("ui_interact")):
handledialog()
func _area_entered(object):
inarea = true
func _area_exited(object):
inarea = false
func handledialog():
get_node("../NinePatchRectangle").vairable("printing")
That is the code.
As you can see, I’m trying to call a variable from another script for the dialog box to display. It isn’t working. Anyone have a solution?