Help creating dialogic node with Area 2d

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By chunkymilkyo

Hey all, I’m still learning Godot. But I’m trying to see how I can start a dialogic node when the player is in the Area2d collision. So far, i can only get a mouse click to work but I don’t know how to do with when player is close by and trigger it by a key on the keyboard

Here’s my current code:

`extends Area2D

func _ready():
pass # Replace with function body.

func _on_YoMama_input_event(viewport, event, shape_idx):
if event is InputEventKey:
if event.pressed and event.scancode == KEY_ESCAPE:
var dialog = Dialogic.start(“convoWithKitty”)

thanks again!

Try formatting your code with the { } icon so that its readable. It will be easier to find help that way.

magicalogic | 2021-05-12 05:05

:bust_in_silhouette: Reply From: bakc

maybe you could use a signal from areas2d.
when signal on,var set true,then set false,after you can use

if var=true && Input.get_action_pressed("ui_select"): var dialog = Dialogic.start("convoWithKitty")