Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Rabbitnap |
Hey, i’m currently working on a small pice of code. It should handle the case, whenever the player is in a certan area and presses a certain button the dialouge box should appear and when he leves the area the box should disappear.
This is my code:
extends Polygon2D
var inarea = false
func _ready():
pass
func _on_Area2D_body_entered(body):
var inarea = true
func _physics_process(delta):
if (Input.is_action_just_pressed("attack")):
if inarea == true:
$AnimationPlayer.play("FadeIn")
print("TextBoxDebug")
else:
pass
func _on_RichTextLabel_done():
$AnimationPlayer.play("FadeOut")
func _on_Area2D_body_exited(body):
if inarea == true:
$AnimationPlayer.play("FadeOut")
else:
inarea = false
my script worked until i added the check for the button press. I have no clue why is broken now…