0 votes

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!

in Engine by (15 points)

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?

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! :)

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.

1 Answer

+1 vote
Best answer

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.

by (67 points)
selected by

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

you're welcome, and have fun

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.