I am making a side-scrolling platformer and I have a few “NPCs”, but I do not know how to add dialogue to the NPCs, Can anyone help me?
I guess you will have to use text object and sprite(you place the text at given coords and the sprite under it (the sprite will be the dialogue baloon or whatever you want it to be)), or you can make the whole dialogue a sprite and play with it however you want for example adding letter after letter can be made in the animations or anything. To change the text font you will have to copy paste the file of the font you want to use with extention .ttf into the project folder, then for Font:_______ you type the font name + extention >example> Arial.ttf.
There are various ways to handle dialogue, depending on how complex it is and how many different things you want the NPC to say. Possibly the simplest way is to prepare several sprites of speech bubbles and put them each as separate animations within an object called something like NPC1_speech. It would look something like this:
You would then position the NPC1_speech object in the scene next to the NPC and use the “At the start of the scene” condition to hide the NPC1_speech object. Whenever the player satisfies the condition that triggers the speech e.g. by colliding with the NPC, you use the show object action to display the NPC1_speech object. You can then hide the NPC1_speech object when the player moves away using the same condition (collision), but with the “invert this condition” box ticked.
Whenever something happens so that the text needs to change, you just change the animation of NPC1_speech to 1, then the next time to 2, and so on.