Course page
Log in

You are watching a free preview. Enroll to open all 27 lessons, track progress and ask the course tutor.

Enroll for $44.99

Section 1: Getting to know Godot

The editor, nodes and your first scene

Article 13 min Lesson 2 of 27 Preview

Open the starter project in Godot. The editor has a few main areas:

  • Scene dock (top left): the node tree of the scene you are editing.
  • FileSystem dock (bottom left): all files in your project.
  • Viewport (centre): where you see and arrange your scene. Switch between 2D, 3D and Script at the top.
  • Inspector (right): properties of the selected node.

Creating a scene

Click Scene, New Scene, then choose 2D Scene as the root. A Node2D appears in the scene dock. Rename it to Level by double clicking. Save with Ctrl+S (Command+S on a Mac) as levels/level_01.tscn.

Now add a child node: select Level, press Ctrl+A and search for Sprite2D. In the Inspector, find the Texture property and drag art/background.png from the FileSystem dock onto it. You now have a background image.

Running the game

Press F6 to run the current scene. A window opens with your background. Press F5 to run the project's main scene; the first time, Godot asks which scene that should be. Choose level_01.tscn.

Positions and the 2D coordinate system

In Godot 2D, the origin is the top left. x grows to the right and y grows downwards. This catches many beginners out when writing jump code: moving up means a negative y velocity.

Select the sprite and move it with the mouse, or type a value in Transform, Position in the Inspector. Snap settings at the top of the viewport help keep things aligned to a grid, which matters later for tiles.

Instancing scenes

Open scenes/seed.tscn from the FileSystem dock. It contains an Area2D with a sprite and a collision shape. Go back to your level, and drag seed.tscn from the FileSystem into the viewport three times. You have created three instances of the seed scene. If you change the seed scene later, for example its sprite, all instances update.

Project settings

Open Project, Project Settings, Display, Window and set the viewport size to 640 by 360 with the stretch mode set to canvas_items. Pixel art games usually use a small base resolution that scales up cleanly. Also set the default texture filter to Nearest under Rendering, Textures, so pixel art stays crisp instead of blurry.

← → switch lessons