![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Ultra8Gaming |
I found this script a bit messy and uncluttered, can you make this shorter (without using street_sign_player_inside and placing the input function inside the signal), thanks.
Script:
extends Node2D
onready var player = $YSort/Characters/Player #Directory to player
func _input(event):
if event.is_action_pressed(“ui_interact”) && street_sign_player_inside:
player.talk(#Some variables)
func _on_StreetSign_body_entered(body):
if !body.is_in_group(“Player”):
return
street_sign_player_inside = true
func _on_StreetSign_body_exited(body):
if !body.is_in_group(“Player”):
return
street_sign_player_inside = false