Create a New Godot 4 Project (2D)
In Godot, a project is a folder that contains your scenes, scripts, assets, and a project.godot file with settings. For a 2D game, the most important early decisions are your target resolution, how the game scales to different screens, and a consistent workflow for organizing files.
Step-by-step: Create the project
- Open Godot 4 and click New Project.
- Name it (example:
Mini2DGame). - Choose an empty folder location (avoid cloud-synced folders if possible to reduce file-locking issues).
- Select Renderer: keep the default unless you have a specific reason to change it.
- Click Create & Edit.
Configure Core Project Settings for 2D
Project settings define how your game window behaves, how it scales, and how input is mapped. Setting these early prevents constant rework later.
Display resolution and stretch mode
Go to Project > Project Settings, then use the search bar to find the following settings.
| Setting | Where | Recommended for beginner 2D | Why |
|---|---|---|---|
| Window Width/Height | Display > Window | Example: 320x180 (pixel art) or 1280x720 (HD) | Defines your base design resolution. |
| Stretch Mode | Display > Window | canvas_items | Scales 2D content reliably. |
| Stretch Aspect | Display > Window | keep or expand | keep preserves aspect ratio; expand uses extra space on wider screens. |
If you are making pixel art, a common pattern is a small base resolution (like 320x180) and letting Godot scale it up. If you want crisp pixels, you will also adjust texture filtering (covered below).
Input Map (actions you will use in code)
Instead of checking raw keys in scripts, Godot encourages actions (named inputs). This makes it easy to support keyboard, gamepad, and remapping later.
Continue in our app.
You can listen to the audiobook with the screen off, receive a free certificate for this course, and also have access to 5,000 other free online courses.
Or continue reading below...Download the app
Step-by-step: Add basic actions
- Open Project > Project Settings.
- Go to the Input Map tab.
- Add these actions (type name, click Add):
move_left,move_right,move_up,move_down,jump,pause. - For each action, click the + icon and assign keys (example):
move_left: A, Left Arrowmove_right: D, Right Arrowmove_up: W, Up Arrowmove_down: S, Down Arrowjump: Spacepause: Escape
These action names will be used in scripts like Input.get_vector() and Input.is_action_just_pressed(), keeping your gameplay code clean and consistent.
Editor Workflow: Know the Key Panels
Godot’s editor is designed around building Scenes (node trees) and editing their properties in the Inspector. Understanding where things live will speed up every task.
Scene dock (left)
The Scene dock shows the node tree for the currently open scene. You will:
- Add nodes (Player, Camera, TileMap, UI, etc.).
- Reorder nodes (parent/child relationships matter).
- Right-click nodes to add scripts, set groups, or change node type.
Inspector (right)
The Inspector shows properties for the selected node or resource. You will:
- Tweak transforms (position/scale), visuals, collisions, and script variables.
- Edit resources like materials, animations, and import settings (via resources).
FileSystem (bottom-left)
The FileSystem dock is your project folder view. You will:
- Create folders and move assets.
- Open scenes and scripts.
- Verify imported assets are recognized by Godot.
2D viewport (center)
The 2D workspace is where you place and arrange 2D nodes visually. Key habits:
- Use snapping for pixel art (toggle snap icons in the toolbar).
- Use the top toolbar to switch between Select/Move/Rotate/Scale tools.
- Use the camera preview only when needed; otherwise focus on scene composition.
Script editor (top area when opened)
The Script workspace is where you write GDScript. You can switch between 2D and Script tabs at the top. A practical workflow is:
- Build node structure in 2D.
- Attach scripts to key nodes (Player, Game, UI).
- Return to 2D to test and tweak properties.
Establish a Clean Folder Structure
A consistent folder structure prevents chaos as your project grows. Create these folders in the FileSystem dock (right-click the root and choose New Folder).
scenes/(all.tscnscene files)scripts/(all.gdscripts)art/(sprites, tilesets, backgrounds)audio/(music and sound effects)ui/(UI scenes, fonts, theme resources)
Optional but useful as you scale:
art/characters/,art/tiles/,art/backgrounds/scenes/levels/,scenes/entities/,scenes/ui/
Import Assets and Set Texture Options for 2D / Pixel Art
Godot imports files into engine-ready resources. For textures, the most important early choice is whether you want smooth filtering (good for HD art) or crisp pixels (good for pixel art).
Step-by-step: Import your assets
- Drag and drop your image files (PNG) into
art/in the FileSystem dock, or copy them into the folder using your OS file manager. - Click an imported texture in the FileSystem to see its Import tab (usually next to the Inspector).
Texture import settings (common choices)
| Goal | Setting to check | Where/How | Result |
|---|---|---|---|
| Pixel art looks crisp | Disable filtering | In the texture Import tab, set Filter to Nearest (or disable filter depending on the import UI) | No blur when scaled. |
| No edge bleeding on spritesheets | Disable mipmaps | Turn off Mipmaps | Prevents unwanted smoothing at different scales. |
| Keep file size reasonable | Compression | Use default lossless/VRAM compression unless you see artifacts | Good performance without visual issues. |
Step-by-step: Apply import changes
- After changing import options, click Reimport.
- Repeat for other textures that should share the same look (especially spritesheets and tiles).
If you have both pixel art and smooth UI art, you can keep different import settings per texture. The key is consistency: all pixel art textures should use the same filtering approach.
Create a Minimal Playable Test Scene (Workflow Validation)
This scene is not your final game. It is a fast way to confirm that: (1) your project settings are correct, (2) your input actions work, (3) your assets import correctly, and (4) you can run the game end-to-end without friction.
Step-by-step: Build the test scene
- Create a new scene: click + (New Scene) and choose 2D Scene.
- Rename the root node to
TestLevel. - Save it as
scenes/test_level.tscn.
Add a simple player node
- Select
TestLeveland add a child node: CharacterBody2D. Rename it toPlayer. - Add a child of
Player: Sprite2D. Assign a texture fromart/(any placeholder sprite). - Add a child of
Player: CollisionShape2D. In the Inspector, set Shape to a new RectangleShape2D (or CapsuleShape2D) and size it to match the sprite.
Add a floor to stand on
- Add a node under
TestLevel: StaticBody2D. Rename it toFloor. - Add a child of
Floor: CollisionShape2D with a RectangleShape2D sized wide like a platform. - (Optional) Add a Sprite2D under
Floorfor a visible ground texture, or use a ColorRect if you just want a colored block.
Attach a movement script using the Input Map
Create a script file at scripts/player.gd and attach it to the Player (CharacterBody2D). Use actions from the Input Map so you can change keys later without changing code.
extends CharacterBody2D
@export var speed: float = 160.0
@export var jump_velocity: float = -320.0
func _physics_process(delta: float) -> void:
# Horizontal movement from Input Map actions
var dir := Input.get_axis("move_left", "move_right")
velocity.x = dir * speed
# Gravity (use project default)
if not is_on_floor():
velocity += get_gravity() * delta
else:
if Input.is_action_just_pressed("jump"):
velocity.y = jump_velocity
move_and_slide()Notes:
Input.get_axis()returns -1..1 based on your mapped actions.get_gravity()uses the project’s default 2D gravity settings, which is convenient for quick tests.
Set the test scene as the main scene
- Go to Project > Project Settings.
- Open Application > Run.
- Set Main Scene to
scenes/test_level.tscn.
Run and validate
- Click Play (top-right) or press
F5. - Confirm: the player moves left/right, can jump, and collides with the floor.
- If the sprite looks blurry (pixel art), revisit the texture import filter settings and reimport.
Workflow Checklist (Use This Every Time You Add Content)
- Assets: placed into the correct folder (
art/,audio/,ui/). - Import: texture filtering/mipmaps match your art style.
- Scenes: saved under
scenes/with clear names. - Scripts: saved under
scripts/, attached to the correct node. - Input: new controls added to Input Map (not hard-coded keys).
- Run: test in a minimal scene before building more complex systems.