0 votes

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 onYoMamainputevent(viewport, event, shapeidx):
if event is InputEventKey:
if event.pressed and event.scancode == KEY
ESCAPE:
var dialog = Dialogic.start("convoWithKitty")
add_child(dialog)
`

thanks again!

Godot version 3.3
in Engine by (12 points)

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

1 Answer

0 votes

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")

by (14 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.