Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dynamite09 |
Hi,
I’ve created a Player that can talk with some random npcs. When the player is facing the npc, the player’s raycast detect the npc and if the player uses “ui_accept”, the dialogue start.
When the dialogue is over (to skip further the text, the player uses “ui_accept”), the dialogue starts again because when the player uses “ui_accept” he’s still facing the npc.
The player’s script:
func _physics_process(delta):
get_input(delta)
get_object_collided()
func get_object_collided():
if canMove:
var target = $RayCast2D.get_collider()
if target != null:
if target.is_in_group("NPC"):
if Input.is_action_just_pressed("ui_accept"):
emit_signal("startDialogue", target)
The Interface’s script:
func input(event):
if global.isTalking:
if Input.is_action_just_pressed("ui_accept") and (dialogueState != dialogueLenght):
dialogueState += 1
updateDialogue()
So, my question is: "how can I switch the inputs from the player to the Interface and viceversa?