0 votes

Sorry for the noob-ness, but I'm looking to create a very basic interaction between the player and an NPC in my 2D RPG, where the player approaches the NPC and interacts with them and a dialogue box pops up with a simple message. I've created the player and the NPC, but haven't been able to make anything happen.

I don't even have any sample code to share because I've tried following several tutorials but not gotten anywhere, and I think I need to take a step back and get a fresh perspective.

So any guidance on the most basic way to cause a player action to trigger an NPC response would be hugely appreciated!

Godot version 3.2.3
in Engine by (18 points)

1 Answer

0 votes

I'll give you one way to do this:

Have an Area2D on the player character and another one on the NPC. On the player, check for input and if the input is the correct input for interaction, check if the player is in the NPC's area. If it is, then pop up the dialogue box.

by (6,358 points)

This sounds good - what kind of code would be needed to make the dialogue box pop up?

Thanks!!

Simply showing and hiding the dialogue box would be enough.

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.