A collection of Godot Engine learning projects, documenting my journey through game development with GDScript.
- Overview
- Projects
- Getting Started
- Godot Concepts Covered
- Project Structure
- Learning Resources
- Contributing
- License
This repository contains my learning projects as I explore the Godot game engine and GDScript programming. Each project focuses on different aspects of game development.
Focus: Basic GDScript concepts and node structure
Topics Covered:
- Node types (Area2D, Sprite, Node2D)
- GDScript syntax and structure
- Variables and functions
_process()and_init()methods- Preloading resources
- Creating and managing sprites
Key Files:
Player.gd- Player node implementationmvtManager.gd- Movement managerDirections.gd- Direction constantsMain.gd- Main scene script
Focus: Character movement and collision detection
Topics Covered:
- KinematicBody2D for character movement
- RayCast2D for collision detection
- Input handling with
_unhandled_input() - Tween animations for smooth movement
- Collision groups
- Tile-based movement
Key Files:
Player.gd- Player movement with raycastRoot.gd- Root scene managementgoal.gd- Goal/objective handlingtarget.gd- Target interactions
- Godot Engine: Version 3.x or 4.x (check project.godot for version)
- GDScript: Basic knowledge helpful but not required
# Clone the repository
git clone https://github.com/Ibrahimibrahimi/godot-learning.git
cd godot-learning- Open Godot Engine
- Click "Import" or "Open Project"
- Navigate to the project folder (e.g.,
6 - learning about godot script) - Select the
project.godotfile - Click "Import & Edit"
- Press F5 or click "Play" to run the project
| Node Type | Purpose | Used In |
|---|---|---|
Area2D |
2D area for collisions/interactions | Project 6 |
KinematicBody2D |
Physics-based character movement | Project 7 |
Sprite |
2D image display | Project 6 |
Node2D |
Base 2D node | Both |
RayCast2D |
Directional collision detection | Project 7 |
Tween |
Smooth property animations | Project 7 |
# Variables
var speed = 100
var direction = Vector2.UP
# Functions
func _process(delta):
# Called every frame
move(delta)
# Signals
func _on_body_entered(body):
# Called when body enters area
print("Collision with: ", body.name)# Using built-in input actions
func _unhandled_input(event):
if event.is_action_pressed("ui_up"):
move(Vector2.UP)
if event.is_action_pressed("ui_down"):
move(Vector2.DOWN)# RayCast for collision checking
onready var ray = $RayCast2D
func can_move(direction):
ray.cast_to = direction * PIXEL_SIZE
ray.force_raycast_update()
return not ray.is_colliding()# Smooth movement with Tween
func move_tween(target_position):
$Tween.interpolate_property(
self,
"position",
position,
target_position,
0.1,
Tween.TRANS_SINE,
Tween.EASE_IN
)
$Tween.start()godot-learning/
├── README.md # This file
├── LICENSE # MIT License
│
├── 6 - learning about godot script/ # Basic GDScript
│ ├── project.godot # Godot project file
│ ├── Player.gd # Player script
│ ├── mvtManager.gd # Movement manager
│ ├── Directions.gd # Direction constants
│ ├── Main.gd # Main scene
│ ├── Node2D.tscn # Main scene file
│ ├── icon.png # Default icon
│ └── default_env.tres # Default environment
│
└── 7 - player mouvement & collisions/ # Movement & Collisions
├── project.godot # Godot project file
├── scripts/
│ ├── Player.gd # Player with raycast
│ ├── Root.gd # Root scene
│ ├── goal.gd # Goal handling
│ └── target.gd # Target interactions
├── assets/ # Game assets
│ ├── tilemap_packed.png
│ └── *.png # Tile sprites
├── Root.tscn # Root scene file
└── level.tscn # Level scene file
- Basic GDScript syntax
- Node types and hierarchy
-
_process()and_init()methods - Preloading resources
- Sprite management
- Input handling
- KinematicBody2D movement
- RayCast2D collision detection
- Tween animations
- Collision groups
- AnimationPlayer
- TileMap systems
- Scene management
- Signal connections
- Physics bodies
- Particle systems
- Audio integration
- UI systems
- Exporting projects
extends Area2D
var speed = 55
var direction = Vector2.ZERO
func _process(delta):
if Input.is_action_pressed("ui_right"):
direction = Vector2.RIGHT
elif Input.is_action_pressed("ui_left"):
direction = Vector2.LEFT
position += direction * speed * deltaextends KinematicBody2D
const PIXEL_SIZE = 16
onready var ray = $RayCast2D
func move(direction):
var vector_pos = direction * PIXEL_SIZE
ray.cast_to = vector_pos
ray.force_raycast_update()
if not ray.is_colliding():
$Tween.interpolate_property(
self, "position",
position, position + vector_pos,
0.1, Tween.TRANS_SINE, Tween.EASE_IN
)
$Tween.start()Contributions are welcome! Feel free to:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Ibrahim Ibrahim - GitHub
⭐ If you find this helpful, please give it a star!