Back

Activity 1.1: Getting Started with Godot

divider

Activity 1.1

Getting Started with Godot

Key Concepts

What a Game Actually Is

The Game Loop

What Is a Game?

A movie plays the same way every time. A game does not, because a game is waiting for you.

What Is a Game?

Underneath every game ever made is the same short list of instructions, repeating.

The Game Loop

Diagram of the game loop: Input flows to Update, Update flows to Render, and Render flows back to Input, repeating every frame

The Game Loop

  • Input — what did the player just do?
  • Update — move everything, check what hit what
  • Render — draw the result on screen

Sixty Times a Second

That loop runs about 60 times every second. One trip around it is called a frame.

Sixty Times a Second

Nothing in a game moves smoothly. Everything jumps a tiny distance, sixty times a second, too fast for you to see the steps.

What an Engine Does

A game engine runs that loop for you, and brings along the parts every game needs anyway.

What an Engine Does

  • Drawing pictures on screen
  • Reading the keyboard and mouse
  • Physics — gravity, collisions
  • Playing sound

You write the part that makes your game different.

Godot

This course uses Godot 4.7. It is free, it is small, and it exports games that run in a web browser.

Today's Objectives

  • Describing the game loop: input, update, and render
  • Creating a Godot project and saving a scene
  • Putting an image on screen and running the game

Key Terms

Game Loop
The cycle a game repeats every frame: read input, update the world, draw the result.
Frame
One trip around the game loop.
Game Engine
Software that runs the game loop and provides the parts every game needs, so you only build what is unique to yours.
Node
A single building block in Godot. Everything in a Godot game is made of nodes.
Scene
A saved arrangement of nodes that you can reuse as many times as you want.

'F' → Fullscreen

divider

Build

You are going to start the game you will be building for the next two weeks. It is called Junkyard, and by the end of it you will be flinging a wrecking ball at a stack of crates.

Today it is going to be one crate, sitting still. Everyone starts somewhere.

Before you start. Read How This Course Uses Godot if you have not already. It is short, and every activity in this course assumes it.


Task 1: Get the Starter Pack

  • Download the Junkyard Starter Pack and unzip it. It holds every image this game uses, plus a README explaining what each one is for.
  • Put the unzipped folder somewhere you can find it again — your Z: drive is the safe choice. You will be copying files out of it for the next several activities, not just today.

Task 2: Create the Project

  • Open Godot. The Project Manager window opens first.
  • Click Create, and name the project junkyard.
  • Set the project folder to your Z: drive so your work follows you between machines.
  • Leave the renderer set to Compatibility. That is the one that works in a web browser, which is how you will share this game later.
  • Click Create & Edit.
[STILL — Project Manager create dialog, name and renderer filled in]

Never put a Godot project inside a synced folder like Google Drive or OneDrive. Godot writes hundreds of small files while you work, and sync software will corrupt them. The Z: drive is fine. A synced folder is not.


Task 3: Find Your Way Around

The editor looks busy. You only need four parts of it today, so find each one before moving on.

  • Scene (top left) — the list of nodes in whatever you are currently building.
  • FileSystem (bottom left) — every file in your project.
  • Viewport (middle) — what your game looks like. Make sure the 2D button at the top is selected, not 3D.
  • Inspector (right) — the settings of whichever node you have selected.
[STILL — empty editor in 2D view, the four docks labeled]

Task 4: Add the Artwork

  • In the FileSystem dock, right-click the res:// folder and choose Create Folder. Name it crate.
  • From the starter pack, drag crate.png into that new folder.

One folder per object, holding everything that belongs to it. That is rule five, and it is why this game will still be findable in six weeks.


Task 5: Build the Scene

  • In the Scene dock, click Other Node, choose Node2D, and click Create.
  • Rename it to Main by double-clicking its name.
  • With Main selected, click the + button and add a Sprite2D as its child.
  • Select the Sprite2D. In the Inspector, find the empty Texture slot and drag crate.png onto it from the FileSystem dock.
[CLIP — dragging crate.png from FileSystem onto the Texture slot · the crate appears in the viewport · from tag junkyard/1-1]
Text fallback: drag the file from the FileSystem dock and drop it directly on the word "empty" in the Texture row of the Inspector. The crate appears in the viewport as soon as you let go.
  • Set the Sprite2D's Position to 640, 360 in the Inspector. That is the middle of the screen — you will find out why in the next activity.
  • Save the scene with Ctrl+S. Create a folder called main and save it as main.tscn inside it.

Task 6: Set Up the Window and Run It

  • Open Project → Project Settings. Under Display → Window, set Viewport Width to 1280 and Viewport Height to 720.
  • Close Project Settings.
  • Press F5 to run the game. Godot will ask which scene should be the main one — choose Select Current.

Challenge (Optional)

  • Add a second Sprite2D to Main, give it the same crate texture, and put it somewhere else on screen.
  • Then work out which of your two crates is drawn on top, and see if you can figure out what decides that.
divider

Checkpoint

Run the game and check all four of these:

  • A window opens, and it is wider than it is tall.
  • One crate is sitting in the middle of it.
  • Nothing moves, and nothing happens when you press keys.
  • The Scene dock shows Main with Sprite2D indented underneath it — two levels, exactly like rule two says.
[STILL — the running game, one crate centered on a 1280×720 window · from tag junkyard/1-1]

"Nothing happens" is the correct result today. You have built the stage. The game goes on it starting next session.

divider

Reflection

Answer the following questions before submitting your work.

  1. A game runs its loop about sixty times a second even when the player is doing absolutely nothing. Why can it not just wait until a key is pressed?
  2. You put an image on screen without writing any code. What did the engine do for you that you would otherwise have had to build yourself?
  3. Your scene has a Sprite2D inside a Node2D rather than the two sitting side by side. What do you think that arrangement is meant to tell you about how the two nodes are related?
divider

Submit

Submit the required files to the appropriate dropbox.

Activity Complete