How do I make a new level?
1) Create a new scene with a Node or Node2D as root. Add a YSort node as child and drag to
the level the scenes res://scenes/misc/music_track.tscn and res://scenes/misc/[Link] keeping
them as children of the root node.
2) Clicking on music_track you see a “Music Track” property in the inspector. You can drag any
ogg file to it and it’ll autoplay when entering the level
3) Everything flat that should always appear below the rest of the elements (floor decoration,
water puddles, etc) can be dragged to the scene as a direct child of the root node.
Everything with height like characters, trees, houses, etc goes inside the YSort node. This will
sort them automatically in the z dimension based on their y position.
How do add add the player character to the level?
Add the scene res://scenes/characters/[Link] as a child of the YSort node. If we don’t define
any spawnpoints the position of that scene will be used for spawning.
How do I add a spawnpoint to my level?
1 ) Add a Position2D node and give it a name, preferably all lowerspace and without spaces.
2 ) Add the Position2D node you just created to the “spawnpoints” group
3) Place it wherever you want it in the scene.
How do I make doors that go from level to level?
1 ) Crear an Area2D node with a CollisionShape2D in whatever shape you want.
2 ) Assign to it the script at res://scenes/misc/[Link]
3 ) Click again on the Area2D. The inspector will show a “To Scene” variable where you can
drag and drop your destination scene. You can optionally type the name of a spawn point in
“Spawnpoint”. If the destination scene contains a spawn point with that name the player will
spawn there, otherwise it will just spawn wherever the character scene is placed in the level.
This is useful for levels with multiple entrances/exits
How do I add an NPC?
1 ) Drag to the level the scene at res://scenes/characters/[Link] and make it a child of your
YSort node.
2 ) Right click on your newly added node and select “Editable Children”
3 ) You can place the trigger node wherever you want, or even change the shape for a new want
if you don’t want it to be a square. This defines the area where the player has to be standing to
interact with the NPC. Make sure you don’t have to NPCs with overlapping triggers.
4 ) If we click on the main node for our npc we’ll see some options in the inspector. We can give
the NPC a name for the dialog box and assign it some dialogs. The NPC will say a different one,
in order whenever you talk to them, going back to the first one when out of dialogs.
How do I create a quest giver?
1 ) Drag the scene at res://scenes/misc/[Link] to the level, setting it as a child of an NPC.
This will turn it into a quest giver
2 ) Click on the Quest node and in the inspector you’ll see the following options:
Quest Name: The name for our quest. Can be anything we want
Required Item: The item type we have to find. It can be any text but has to match with the “Item
Name” property of the quest items you’ll spawn.
Required Amount: The amount you need for the quest to be deliverable
Reward Item: The name of the item you’ll receive. It can be any string.
Reward amount: The amount of that item to give to the player.
Initial Text: This is what the NPC will say when giving the quest.
Pending Text: Reminder text if we talk to the NPC without the required items.
Delivered Text: What the NPC will say when we complete the quest
Once the quest is complete the NPC falls back the generic dialog list.
How do I check if the player has an item/has
completed a quest, in order to allow it into some part
of the map.
You can use an Area2D and connect the body_entered() signal. See [Link] as reference.
-- You can use if body is Player to make sure it’s the player entering the area
-- To match agains an item you can do if Inventory.get_item(item_name) >
required_quantity:
For example:
If Inventory.get_item(“Red Access Card”) > 0: checks if the player has at least
1 item called “Red Access Card”
-- To check if it has a quest in any state you can do if Quest.get_status(quest_name) == state:
For example:
If Quest.get_status(“Defeat the Demon Lord”) ==
[Link]: checks if “Recrear Image en Minecraft” is complete
How do I make a character spawn an item when
killed?
1 ) Add res://scenes/misc/item_spawner.tscn as a child scene of our enemy
2 ) When clicking item_spawner you’ll get the following in the inspector:
Item Type: The item name. If it’s required for a quest the string mas match exactly with
Quest.required_item
Amount: Amount of the item you receive when picking it up.
If making a kill quest you can make the enemy drop a part of it’s body. If it drops money it could
be something like “Gold”, “100”
3) In the enemy script, when we want it to spawn an item we do
get_node(“item_spawner”).spawn() or simply $item_spawner.spawn()