Learning Objectives
Understand Interface
Navigate GoDot's editor interface and understand its components
Scenes & Nodes
Learn about GoDot's scene system and node hierarchy
Project Structure
Create and manage GoDot projects effectively
Basic Scripting
Write simple GDScript code for basic functionality
GoDot Interface
Main Editor Window
When you open GoDot Engine, you'll see the Project Manager. After creating or opening a project, you'll be taken to the main editor interface with several key areas.
Key Interface Components
Scene Tab
Shows the node tree and scene hierarchy
Viewport
Main editing area where you see your scene
FileSystem Tab
Browse and manage project files
Inspector
View and edit properties of selected nodes
Navigation and Controls
Mouse Controls
- Left Click: Select nodes and objects
- Right Click: Context menu
- Middle Click + Drag: Pan the viewport
- Scroll Wheel: Zoom in/out
Keyboard Shortcuts
- Ctrl+S: Save scene
- Ctrl+Shift+S: Save scene as
- F5: Play scene
- F6: Play project
- Ctrl+Z: Undo
- Ctrl+Y: Redo
Scenes & Nodes
Understanding Scenes
In GoDot, everything is built using scenes. A scene is a tree of nodes that represents a part of your game, such as a level, menu, or character.
Scene Concept
Tree Structure
Scenes are organized as trees with parent and child nodes
Reusable
Scenes can be saved as .tscn files and reused
Modular
Scenes can be instanced within other scenes
Common Node Types
Node Type | Purpose | Common Use |
---|---|---|
Node2D | Base 2D node | Root node for 2D scenes |
Sprite2D | Display 2D images | Characters, objects, backgrounds |
Label | Display text | UI text, scores, messages |
Button | Interactive button | Menu buttons, UI controls |
Area2D | Detect interactions | Collision detection, triggers |
RigidBody2D | Physics body | Objects with physics simulation |
Creating Your First Scene
Step-by-Step Scene Creation
- Create a new scene:
- Go to Scene → New Scene
- Or press Ctrl+N
- Add a root node:
- Click the "Other Node" button
- Search for "Node2D"
- Click "Create"
- Add child nodes:
- Right-click the root node
- Select "Add Child Node"
- Choose a node type (e.g., Sprite2D)
- Save the scene:
- Press Ctrl+S
- Choose a name and location
- Click "Save"
Project Management
Creating a New Project
Project Setup Steps
- Open Project Manager:
- Launch GoDot Engine
- You'll see the Project Manager window
- Create New Project:
- Click "New Project"
- Enter a project name
- Choose a project location
- Select renderer (2D or 3D)
- Configure Project Settings:
- Set up version control (optional)
- Choose default scene
- Configure input maps
Project Structure
Understanding Project Files
project.godot
Main project configuration file
scenes/
Directory for scene files (.tscn)
scripts/
Directory for script files (.gd)
assets/
Directory for images, sounds, etc.
Practical Examples
Simple Scene Example
# Simple scene structure
# Root: Node2D
# ├── Sprite2D (Player)
# │ └── Label (Name)
# └── Label (Score)
# Player script (attached to Sprite2D)
extends Sprite2D
func _ready():
# Called when the node enters the scene tree
print("Player loaded!")
func _process(delta):
# Called every frame
# delta is the time since last frame
pass
Key Points: This example shows a basic scene structure with a player sprite and UI elements. The script demonstrates the basic lifecycle functions in GoDot.
Basic Input Handling
extends Node2D
var speed = 200
func _process(delta):
# Handle input for movement
var velocity = Vector2.ZERO
if Input.is_action_pressed("ui_right"):
velocity.x += 1
if Input.is_action_pressed("ui_left"):
velocity.x -= 1
if Input.is_action_pressed("ui_down"):
velocity.y += 1
if Input.is_action_pressed("ui_up"):
velocity.y -= 1
# Normalize diagonal movement
velocity = velocity.normalized()
# Move the node
position += velocity * speed * delta
Key Points: This script demonstrates basic input handling using GoDot's built-in input system. It moves a node based on arrow key input.
Node Properties
extends Node2D
func _ready():
# Access and modify node properties
var sprite = $Sprite2D # Get child node by name
sprite.modulate = Color.RED # Change color
var label = $Label
label.text = "Hello GoDot!" # Change text
# Position the node
position = Vector2(100, 100)
# Scale the node
scale = Vector2(2.0, 2.0) # Make it twice as large
# Rotate the node
rotation = PI / 4 # Rotate 45 degrees
Key Points: This example shows how to access and modify various node properties including color, text, position, scale, and rotation.
Summary
Interface Mastery
Learned to navigate GoDot's editor interface
Scene System
Understood scenes, nodes, and hierarchy
Project Management
Created and managed GoDot projects
Basic Scripting
Wrote simple GDScript code
Key Terms
Scene
A tree of nodes that represents part of your game
Node
Basic building block in GoDot's scene system
GDScript
GoDot's Python-like scripting language
Viewport
Main editing area where you see your scene
Inspector
Panel for viewing and editing node properties
FileSystem
Panel for browsing and managing project files