Godot · scenesGodot · escenas
Setting up a new scene from scratch.Preparar una escena nueva desde cero.
Not sure where to start? A great place to begin is by making a new to use as a simple playable area. Add some ground tiles, bring in a player, and you already have a space where you can start testing ideas.¿No sabes por dónde empezar? Un buen punto de partida es hacer una nueva para usarla como una simple área jugable. Añade algunas tiles de suelo, mete un jugador, y ya tienes un espacio donde puedes empezar a probar ideas.
A scene in Godot can be something big, like the playable area you’ll make here, or something small, like a character, tree, or collectible. Scenes are reusable too, so once you have a simple playable area set up, you can reuse it as a starting point instead of rebuilding everything each time. You can also bring in characters, objects, gameplay elements, art, and other pieces that already exist in the StoryQuest Kit.Una escena en Godot puede ser algo grande, como el área jugable que harás aquí, o algo pequeño, como un personaje, un árbol o un coleccionable. Las escenas también son reutilizables, así que una vez que tengas una simple área jugable lista, puedes reutilizarla como punto de partida en lugar de reconstruir todo cada vez. También puedes traer personajes, objetos, elementos de jugabilidad, arte y otras piezas que ya existen en el StoryQuest Kit.
Words with a colored underline open a short explainer. Click any of them to learn more.Las palabras con subrayado de color abren una breve explicación. Haz clic en cualquiera para saber más.
Make an empty scene and give it a root node.Crea una escena vacía y dale un nodo raíz.
Every scene is a small tree of , and it always starts the same way: one node at the top, with everything else added underneath it. That top node is the . Before you add anything or bring anything in, let's make that root node and save the file.Cada escena es un pequeño árbol de , y siempre empieza igual: un nodo arriba, con todo lo demás debajo. Ese nodo de arriba es la . Antes de añadir o traer nada, creamos ese nodo raíz y guardamos el archivo.
starting pointpunto de partida
example finished sceneejemplo de escena terminada
click a number when you've done that stephaz clic en un número cuando termines ese paso
Open a project in Godot.Abre un proyecto en Godot.
Open Godot and load a project. You'll land in the editor with whatever scene was last open.Abre Godot y carga un proyecto. Entrarás al editor con la última escena que estuvo abierta.
Make a new, empty scene.Crea una escena nueva y vacía.
Click the next to the scene tabs, along the very top of the viewport. This is the same row your open scenes sit in. That opens a fresh, empty scene in its own tab. You can have many scene tabs open at once while you work, and you can switch between them.Haz clic en el junto a las pestañas de escena, arriba del todo del viewport. Esta es la misma fila donde están tus escenas abiertas. Eso abre una escena nueva y vacía en su propia pestaña. Puedes tener muchas pestañas de escena abiertas a la vez mientras trabajas, y puedes cambiar entre ellas.
Choose 2D Scene for your root node.Elige 2D Scene para tu nodo raíz.
With the scene empty, the Scene panel shows a Create Root Node menu. Click 2D Scene. Godot puts a Node2D at the top. This is a plain node that will act as a holder for anything you build in the scene.Con la escena vacía, el panel Scene muestra un menú Create Root Node. Haz clic en 2D Scene. Godot pone un Node2D arriba. Este es un nodo simple que servirá de contenedor para todo lo que construyas en la escena.
Rename the root to PlayArea, and save the scene.Renombra la raíz a PlayArea y guarda la escena.
Double-click the Node2D name in the Scene panel and type PlayArea — that's what we'll call this test scene. Then press Ctrl+S (Cmd+S on Mac) and save it as PlayArea.tscn inside the project. You can also save from the top menu bar: Scene → Save Scene As…, shown below.Haz doble clic en el nombre Node2D en el panel Scene y escribe PlayArea — así llamaremos a esta escena de prueba. Luego pulsa Ctrl+S (Cmd+S en Mac) y guárdala como PlayArea.tscn dentro del proyecto. También puedes guardar desde el menú superior: Scene → Save Scene As…, como se ve abajo.
Checkpoint 1Punto de control 1
What you didLo que hiciste
Add a few TileMapLayers to build out your play area.Añade unas cuantas TileMapLayers para construir tu play area.
This scene is going to be a playable area, so let's give it an environment that a character can move around in. One way to build that space is with a , a layer where you place tiles to build part of your game world, using a as your palette. You'll often use more than one TileMapLayer in a scene like this, keeping things like grass, paths, and water separate so you can work with each independently. Smaller scenes, like a character, object, or other reusable piece of the game, may not need TileMapLayers at all.Esta escena va a ser un área jugable, así que vamos a darle un entorno por el que un personaje pueda moverse. Una forma de construir ese espacio es con una , una capa donde colocas tiles para construir parte del mundo de tu juego, usando un como paleta. A menudo usarás más de una TileMapLayer en una escena como esta, manteniendo separadas cosas como la hierba, los caminos y el agua para trabajar con cada una por separado. Las escenas más pequeñas, como un personaje, un objeto u otra pieza reutilizable del juego, quizá no necesiten TileMapLayers en absoluto.
You can reuse TileMapLayers, too. Godot lets you copy a TileMapLayer, including the tiles you’ve already painted, from one scene and paste it into another. That can be a quick way to bring over some ground or part of an environment. In this guide, though, we’ll briefly show you how to add and paint your own TileMapLayers so you know how they work.También puedes reutilizar TileMapLayers. Godot te deja copiar una TileMapLayer, incluidos los tiles que ya has pintado, de una escena y pegarla en otra. Esa puede ser una forma rápida de traer algo de suelo o parte de un entorno. En esta guía, sin embargo, te mostraremos brevemente cómo añadir y pintar tus propias TileMapLayers para que sepas cómo funcionan.
click a number when you've done that stephaz clic en un número cuando termines ese paso
Add a TileMapLayer under PlayArea.Añade una TileMapLayer bajo PlayArea.
Click PlayArea in the Scene panel, then click the Add Child Node button. Search for the TileMapLayer node, and click create. Now you'll have a new node underneath the root node.Haz clic en PlayArea en el panel Scene, luego pulsa el botón Add Child Node. Busca el nodo TileMapLayer y pulsa crear. Ahora tendrás un nuevo nodo bajo el nodo raíz.
Tidy tipOrden — planning a lot of layers? Add another plain Node2D named TileMapLayers first and put the layers under it as children. Think of it like a sub-folder for them, so you can expand or collapse the whole group at once.— ¿vas a tener muchas capas? Añade primero otro Node2D llamado TileMapLayers y pon las capas debajo como hijos. Piénsalo como una subcarpeta para ellas, para expandir o contraer todo el grupo de una vez.
Give the layer a TileSet resource so you can use it to paint.Dale a la capa un recurso TileSet para poder pintar con él.
Select the new layer in the SceneTree and then look at the Inspector on the right side of the screen. Look for the TileSet property. For now, click the dropdown there and choose Quick Load to search for a tileset that already exists in the files. Select the exterior_floors tileset. Now your TileMapLayer has tiles to paint with in your scene.Selecciona la nueva capa en el SceneTree y luego mira el Inspector en el lado derecho de la pantalla. Busca la propiedad TileSet. Por ahora, haz clic en el desplegable y elige Quick Load para buscar un tileset que ya existe en los archivos. Selecciona el tileset exterior_floors. Ahora tu TileMapLayer tiene tiles con los que pintar en tu escena.
Paint some patches of ground.Pinta parches de suelo.
A tile palette opens in the bottom panel. Select a ground tile from the set, choose the paint brush tool, then click and drag around the scene in the viewport to paint with that tile.Se abre una paleta de tiles en el panel de abajo. Selecciona un tile de suelo del set, elige la herramienta pincel, y luego haz clic y arrastra por la escena en el viewport para pintar con ese tile.
Painted in the wrong spot? The is in the same tile toolbar, or press Ctrl+Z to undo the last stroke.¿Pintaste en el lugar equivocado? El está en la misma barra de tiles, o pulsa Ctrl+Z para deshacer el último trazo.
Tip: try when you want to paint an environment quickly. Instead of choosing individual tiles, you can paint an area and Godot automatically picks the right tiles, edges, and corners as you go. This tileset already has Terrains set up for you.Consejo: prueba cuando quieras pintar un entorno rápido. En vez de elegir tiles uno a uno, puedes pintar un área y Godot elige automáticamente los tiles, bordes y esquinas correctos sobre la marcha. Este tileset ya tiene Terrains configurados para ti.
Add another layer for a path or detail.Añade otra capa para un camino o detalle.
Select PlayArea and add another TileMapLayer, then choose the Water TileSet. Paint Base Tiles around the outside of your play area. These tiles have collision, so the player can't walk through them. Use the Alternative Tiles anywhere you want water that the player can move over or stand beside without being blocked.Selecciona PlayArea y añade otra TileMapLayer, luego elige el TileSet Water. Pinta Base Tiles por el borde exterior de tu play area. Estos tiles tienen colisión, así que el jugador no puede atravesarlos. Usa los Alternative Tiles donde quieras agua por la que el jugador pueda pasar o junto a la que pueda estar sin quedar bloqueado.
Name and adjust the order of your nodes in the SceneTree.Nombra y ajusta el orden de tus nodos en el SceneTree.
Layers lower in the SceneTree are drawn on top of other layers or in the foreground. Drag them into the order you want, then give each a clear name like Grass, Paths, or Water.Las capas más abajo en el SceneTree se dibujan encima de otras capas o en primer plano. Arrástralas al orden que quieras, luego dale a cada una un nombre claro como Grass, Paths o Water.
Checkpoint 2Punto de control 2
What you didLo que hiciste
Add a character and a few decorative assets.Añade un personaje y algunos elementos decorativos.
Here's an example of where a bigger scene starts being built from smaller ones. Parts of the game, like characters and decorative objects, can already exist as their own saved scenes. You can bring those scenes into your play area and reuse them instead of building everything again.Aquí tienes un ejemplo de cómo una escena más grande empieza a construirse a partir de otras más pequeñas. Partes del juego, como personajes y objetos decorativos, pueden existir ya como sus propias escenas guardadas. Puedes traer esas escenas a tu play area y reutilizarlas en vez de construir todo de nuevo.
click a number when you've done that stephaz clic en un número cuando termines ese paso
Add a player scene and a Camera2D.Añade una escena de jugador y una Camera2D.
In the FileSystem, find player.tscn, then click and drag it into your PlayArea. You can also open another scene with a player, right-click the player node, copy it, and paste it into yours. Add a Camera2D as a child of the player so the view follows them.En el FileSystem, busca player.tscn y arrástralo a tu PlayArea. También puedes abrir otra escena con un jugador, haz clic derecho en el nodo del jugador, cópialo y pégalo en la tuya. Añade una Camera2D como hija del jugador para que la vista lo siga.
Drop a decorative asset from the files a few times.Suelta un elemento decorativo de los archivos varias veces.
Look through the FileSystem for things you can use to decorate your play area. To show only saved scenes, type .tscn in the FileSystem filter. You might find ready-made pieces like bushes, rocks, or other objects that already include things like collision. Drag them into your scene, or copy and paste pieces from another scene. Pick one you want and click and drag it into the viewport. Each time you do this it is another instance of that one saved scene in the FileSystem, so five trees are five copies of a single “template” scene file.Busca en el FileSystem cosas que puedas usar para decorar tu play area. Para mostrar solo escenas guardadas, escribe .tscn en el filtro del FileSystem. Puedes encontrar piezas ya hechas como arbustos, rocas u otros objetos que ya incluyen cosas como colisión. Arrástralas a tu escena, o copia y pega piezas de otra escena. Elige la que quieras y arrástrala al viewport. Cada vez que lo haces es otra instancia de esa única escena guardada en el FileSystem, así que cinco árboles son cinco copias de un solo archivo de escena “plantilla”.
Tidy tipOrden
Organize your SceneTree.Organiza tu SceneTree.
As your scene gets bigger, you can add more Node2Ds just to keep things organized. Rename one for a group, like Trees, Decorations, or Enemies, then move those objects underneath it. Now you can collapse the whole group to keep the Scene dock easier to read. Check out some of the larger scenes in the kit for examples.A medida que tu escena crece, puedes añadir más Node2Ds solo para mantener el orden. Renombra uno para un grupo, como Trees, Decorations o Enemies, y mueve esos objetos debajo. Ahora puedes colapsar todo el grupo para que el panel Scene se lea más fácil. Mira algunas de las escenas más grandes del kit como ejemplo.
Checkpoint 3Punto de control 3
What you didLo que hiciste
Save and run the scene.Guarda y ejecuta la escena.
click a number when you've done that stephaz clic en un número cuando termines ese paso
Play the scene, and walk around.Ejecuta la escena y camina por ella.
Press F6 to run the scene you have open, or click the Play Scene button in the top-right. Your play area should open with the character ready to move around the space you built. The character can move using the WASD or arrow keys, just like in other scenes.Pulsa F6 para ejecutar la escena que tienes abierta, o haz clic en el botón Play Scene arriba a la derecha. Tu play area debería abrirse con el personaje listo para moverse por el espacio que construiste. El personaje se mueve con las teclas WASD o de flecha, igual que en otras escenas.
Can't see the player?¿No ves al jugador? — if the camera isn't following the character, make sure the Camera2D is a child of the player. If you can see the player but not your TileMaps, the player may be starting far from the area you painted.— si la cámara no sigue al personaje, asegúrate de que la Camera2D sea hija del jugador. Si ves al jugador pero no tus TileMaps, quizá el jugador empieza lejos del área que pintaste.
Checkpoint 4Punto de control 4
What you didLo que hiciste
You can choose where your StoryQuest begins laterPuedes elegir más tarde dónde empieza tu StoryQuest
While you’re building, you can run and test the scene you’re working on. You don’t have to decide yet which scene players will start with.Mientras construyes, puedes ejecutar y probar la escena en la que estás trabajando. Todavía no tienes que decidir con qué escena empezarán los jugadores.
Later, when you know where your StoryQuest should begin, you can set that .tscn file as the Main Scene.Más tarde, cuando sepas dónde debería empezar tu StoryQuest, puedes establecer ese archivo .tscn como la Main Scene.
Try it againInténtalo otra vez
The best way to get comfortable with scenes is to make a few. Try starting another new scene, painting a small area, and bringing in different pieces from the kit.La mejor forma de sentirte cómodo con las escenas es hacer unas cuantas. Prueba a empezar otra escena nueva, pintar un área pequeña y traer piezas distintas del kit.
Not everything you reuse will work perfectly right away. Some scenes depend on other nodes, resources, or settings to function. Try things anyway, run your scene often, and see what works, what needs a little setup, and what you can reuse in your own StoryQuest.No todo lo que reutilices funcionará perfecto de inmediato. Algunas escenas dependen de otros nodos, recursos o ajustes para funcionar. Prueba de todos modos, ejecuta tu escena a menudo, y mira qué funciona, qué necesita un poco de configuración y qué puedes reutilizar en tu propio StoryQuest.