Create your first scene
Now that your Escoria project is opened, let’s start making our first scene.
- Copy the file templates/base_scene.tscn to a file that will be your new scene. We recommend that you create a new directory for every new game scene in the scenes directory. We put our scene is scene/intro-game/scene.tscn
- Open the scene in the editor with the Scene > Open Scene menu option
- Now you can start populating the scene with your items, change the background, etc. (more details below)
One thing you have to take care of is to ensure that the
game node is at the bottom of the scene tree at all times. If not, just drag it there.
Populating the scene with assets
You can find the assets in this repository: https://github.com/flossmanualsfr/escoria
and only the assets for the first quick game here : https://github.com/flossmanualsfr/escoria/tree/first-quick-game/device/scenes/intro-game/sprites
and a complete first game here in an archive here : https://github.com/flossmanualsfr/escoria/archive/first-quick-game.zip
Put the downloaded asset package in the
device directory of your project folder.
Now that the scene is set up, we have to populate it with the player and items. Each element of the scene will be a separate scene which will be instanced in the master one.
You might think it’s complicated, but it helps a lot if we want to reuse our player and some items in several scenes of the game.
Making them available as external resources will make it much easier to work on and test them. This way, all changes done to standalone file will automatically be propagated to all scenes that inherit from it. Let’s start with an example by creating the old man character.
We have written a special chapter for item configuration called The items in section "Escoria fundamentals", read it for more informations.
- Create a new scene and add a root node of the Node2D type. Rename it old_man.
- Attach the globals/item.gd script to that root node. To add a script, select your node in the Scene panel, and in the "Inspector" set the "Script" property, using "Load". It's the last one.
- You can now add a Sprite node to it. In the Inspector, select the sprite Texturesetting and choose Load to apply an image to this element. Here we have used old_man.pngstored in the sprites directory. It may now look good. Don’t worry about the position at this step.
- If you want this to be animated you can add an animation to it as explained in godot book or with an animation node type. Since our character can have several animation associated, the last solution seems to be a better one.
- Generally, you want to detect collisions and clicks (which are kind of important in a point-and-click game).
Add a Control node type to the old_man node, and name it area. On Godot’s central panel, you can use handles to resize it as needed. In this case, having the area fit the size of the picture of Sprite seams reasonable.
- Save this scene as old_man.tscn
- Go back to the main scene and import old_man.tscn to it by clicking the chainicon of the Scenepanel, next to the Plusbutton. Verify it is above the game Node in the tree.
- Finally, scale it using red handles (hold Shift to keep the aspect ratio) or use the Scaleproperty in theInspector, and move it inside the scene until it suits you.
If you want to see what the scene looks like, you can click the play edited scene button on top of godot window or press F6.
Repeat this process for every item you want to have in the scene.