Help with making a 2d VN/Danganronpa style map with interactables and NPCs?

I’m making a first person 2d point and click adventure deckbuilder horror game inspired by weirdcore and Inscryption, but I can’t figure out how to make the NPCs and interactables. Here’s a mockup of what I’m thinking:

If it’s possible, I’d also like a tip on how to make a glowing outline when the mouse is hovering over any thing interactable to indicate that it can be interacted with.

If your characters and interactables inherit from Sprite2D, you can use get_rect to detect if the character/interactable has been clicked on. To constantly check the mouse position (e.g. for the purpose of detecting whether the mouse is hovering over something), you could use get_viewport().get_mouse_position() inside _process(). A glowing outline can be achieved by means of a shader (example.)

It’s probably a bit more involved if characters and interactables can visually overlap each other.

Oh, thank you! :smiley:

Will test it out as soon as I can!

Already got like the sprites set up, just got to actually get it working-

What do you do if it’s the other way around?

(Sprite 2d inherits from Character 2d-)

Physics bodies have signals mouse_entered and mouse_exited you can connect to those and detect clicks with _unhandled_input

var mouse_over: bool = false

func _on_mouse_entered() -> void:
    mouse_over = true

func _on_mouse_exited() -> void:
    mouse_over = false

func _unhandled_input(event: InputEvent) -> void:
    if mouse_over and event.is_action_pressed("Interact"):
        print("clicked me!")

Also, there’s a variable called delta in the _process function. Where do I put it?

Okay!

How do I code the is pressed event? Do I just make a new control input? (Or whatever it’s called-)

event.is_action_pressed takes an action name, you can assign actions and inputs to those actions in the InputMap, a tab in the Project Settings.

Got it!

Then I suppose I just have to conect it with the outline shader and dialog system, right?

Yes, I suppose the outline shader should be enabled under _on_mouse_entered and the dialogue started instead of print("clicked me!")

Tips on how to make the outline shader fade in and out? (sorry if I’m asking a whole lot, I’m new to Godot and a lot of the tutorials I’m finding online just aren’t sticking- ^^')

Depends on your shader code, if you used the example outline shader posted before then you may change it’s color uniform, you could use an AnimationPlayer to increase or decrease it’s alpha over time

Will try it out! Thanks! ^^

Do you have the exact code to do the fade in and out effect?

I’d leverage the AnimationPlayer node to handle the fading in and out, the only code needed would be to start the animation

func _on_mouse_entered() -> void:
    $AnimationPlayer.play("fade_in")
    mouse_over = true

I’m thinking about having a second Sprite2d with the shader equipped that fades in and out as the mouse goes over it-

Would this work?

Yes, you can animate two things at the same time with an animation player, or give the mouse_entered function more code to play more animations.

I can’t exactly figure out the animation function, so I’m trying to code it to make turn on and off the outlined sprite’s visibility-

But it’s not working-

Do I have to rename the second sprite2d or do I have to do something different?

You can rename any node, the names don’t particularly matter they only have to match if you are using them in code. The AnimationPlayer will try to update automatically when nodes are renamed.

I don’t know what you are trying to do or why it’s not working, you must explain what isn’t working. Can you share your new code? If you believe the scene tree is relevant you should share a screenshot of that too.

I’m using the code you gave me with the mouse over and under variables having Sprite2D2.Notification_visibilty_changed = on/off

On a second look, I don’t think it’s the right action either-