How to have top-down 2D character interact with environment with dialogue prompts?

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

I want to create a 2D adventure game where the main character walks around and interacts with objects and NPCs to solve puzzles. I have a RichTextLabel at the bottom of the screen that I’d like to update with relevant information about what the character is interacting with.

I can update the RichTextLabel when sending signals from RigidBody2D objects, but cannot when interacting with RigidBody2D objects set in “Static” mode. No signal information is sent over it seems. I want the objects and NPCs to be immovable in the environment, so this presents a problem.

Any help would be greatly appreciated! If there are any good Godot tutorials for 2D adventure games, I’d love to know!

It’s totally possible for static RigidBody2Ds to send signals. I think something else is up with your game.

Also, if you don’t want the objects to move, why not use StaticBody2D instead of RigidBody2D?

exuin | 2021-05-19 06:59

I think you’re right. I’m still new to Godot and am playing around with a lot of things, so probably something else is causing the signal not to be sent when the NPC is a static RigidBody2D. I couldn’t figure out how to send signals from a StaticBody2D on a collision and didn’t see an option to turn on contact monitoring in the inspector.

I used the solution by MadJester below which works well for the simple game I’m planning.

Thanks for the input and help! :slight_smile:

OuterSpaceFarAway | 2021-05-19 14:07

Oh, you’re using it to send signals from a collision? Then yeah, StaticBodies don’t detect collisions at all - so they won’t send collision signals. Yeah, the solution below is good.

exuin | 2021-05-19 14:11

:bust_in_silhouette: Reply From: MadJester

The signal issue is probably related to the mode of your RigidBody2D node it is simulating a Rigid2D node which has very limited signals.
Depending on how you do your signals this might be the issue.

A possible fix is, simply adding an Area2D node to your player and attach a signal to it
body_entered().

func _on_Area2D_body_entered(body):
   #body is the node that entered the Area2D
	if body.name == "NPC":
		$RichTextLabel.text = 'NPC text'

as for tutorials :
2d platformer
2d rpg
nice to know tutorials
beginner stuff
GDScript fundamentals
basic quest system

Hope this helps, have fun.

This solution worked for my needs. Thank you for your help with this problem, and for the useful links! :slight_smile:

OuterSpaceFarAway | 2021-05-19 14:03

you’re welcome, and have fun

MadJester | 2021-05-19 15:21