the title was incorrect but I can’t edit it for some reason.
I am making a topdown game for my classmates and I want to be able to talk to the NPCs,
So I wanna do these things,
1 - an “!” pops up NPCs’s head when you get near
2 - you can press a button to show and hide the textbox when you are near.
that’s it.
so how do I do it? (pls help I am a noob)
and btw you can make it so the text appears when you go near the npc, that’ll work too
Break your problem down into small pieces…
- Figure out how to display text in the game world.
- Figure out how to position that text at a particular place
- Figure out how to print to the console when the player gets near an NPC
- Figure out how to print to the console when the player presses a button
- Figure out how to give an NPC a list of dialogue to say
- Combine all of the above
Definitely start with any of the Unity “Learn” tutorials series, or look around on Youtube, such as Brackeys on Youtube.
As @PraetorBlue points out above, you have to first understand the problem before you can consider how to solve it, and tutorials can begin to show you how Unity and its environments work.
Use a circle collider 2D on your player that’s as big as the distance you want from the NPCs (so when it collides, the text is shown). This is in addition to the player’s collider.
The text boxes should be attached to the NPCs, and you can show/hide them (and change their text) as needed.
As mentioned, there’s a lot of steps for you to figure out, but it’s all pretty straightforward. Just do things one at a time.
thanks, I’ll try that