Activity 2.1
Building a Scene from Nodes
Key Concepts
Composition
Nodes, Scenes & Physics Bodies
Instancing
Composition
Almost nothing in a game is one giant, monolithic object. Complex things are built by combining small, simple pieces — the same way a LEGO model is built from individual bricks.
What Is a Node?
A Node is the smallest building block in Godot — a sprite, a shape, a sound, a physics body. Each one does one job.
What Is a Scene?
A Scene is a group of Nodes arranged together and saved as one reusable file — that's composition in action.
A Physics Body + A Picture
A RigidBody2D makes something obey physics. ASprite2D gives it a picture. Together, as parent and child, they make a visible object that can move and collide.
Physics Needs a Shape
A sprite is just a picture — the physics engine has no idea what part of it is "solid." ACollisionShape2D defines that explicitly, separate from how the object looks.
Instancing
Once a Scene is saved, you can place it —instance it — as many times as you want. Each instance is its own independent copy.
Today's Objectives
- Building a reusable Player scene out of Nodes
- Giving that scene a physics collision shape
- Instancing it multiple times into your game
Key Terms
- Node
- The smallest building block in Godot.
- Scene
- A group of Nodes arranged together and saved as one reusable file.
- RigidBody2D
- A Node that obeys the physics engine — forces, gravity, collisions.
- Sprite2D
- A Node that displays a 2D image.
- CollisionShape2D
- A Node that defines the solid shape a physics body uses for collisions.
- Instance
- A placed copy of a saved Scene.