Video summary
Make a Roguelite Mining Game in Godot 4 - Complete Beginner Tutorial
Main summary
Key takeaways
Tech/Build Summary (Godot 4 Mining Roguelite Tutorial)
Project goal & systems covered
- Build a complete 2D mining roguelite in Godot 4 from scratch.
- Core loops/systems introduced:
- Player character (animated, smooth movement, collision)
- Randomized mining gameplay (pickaxe swing, mining cooldown, hit detection)
- Rocks & ore system (rock health, ore dropping, ore pickups)
- Visual/audio polish (tweens for ore bounce/flash, sound effects)
- Tile-based map generation & collision (TileMap layers, terrain/props, camera)
- Procedural rock spawning based on spawnable tiles
- Notes that the full Udemy course adds inventory, shop upgrades between runs, more level layouts, and oxygen survival.
Player setup (Scene/Nodes/Assets)
- Starts from a blank Godot project and creates:
- CharacterBody2D as
player - Uses a top-down fantasy RPG sprite pack with sprite sheets and directional animations.
- CharacterBody2D as
- Creates
animated_sprite_2Dusing AnimatedSprite2D and configures sprite sheet slicing:- Adjusts frame grid (e.g., from 4x4 to larger counts like 6x10 / 6x10 patterns)
- Ensures pixel-art sharpness by switching filtering:
- Per-sprite:
texture.filter = nearest - Project-wide: set default texture filter in Project Settings > Rendering > Textures to nearest
- Per-sprite:
- Fixes resolution/scaling issues:
- Changes viewport defaults (example: 320x180 scaling up to window override 1280x720)
- Adds CollisionShape2D to the player:
- Rectangle sized to match torso/feet, avoids head collision so the sprite can overlap visuals properly.
Movement & input (script organization + 4-directional control)
- Player script:
- Extends CharacterBody2D, removes jump/gravity-related code for a ground-based top-down setup.
- Uses
move_and_slide()for movement/collision handling.
- Input system:
- Adds actions in Input Map:
up/down/left/right(WASD)- later
use_pickaxe(Space)
- Switches movement to 4-direction input using
get_vector(left, right, down, up)(instead ofget_axis()-style).
- Adds actions in Input Map:
- Animation handling split into functions:
process_movement()process_animation()play_animation(prefix, direction)where prefix isidleorrun
- Direction tracking:
- Introduces
last_directionto keep facing direction when input stops.
- Introduces
- Left/right animation optimization:
- Uses FlipH on AnimatedSprite2D instead of duplicating left sprite animations (idle/run use shared frames).
Mining animation & state control (prevent animation conflicts)
- Adds mining animations from a player actions sprite sheet:
swing_pickaxe_down,swing_pickaxe_right,swing_pickaxe_up
- Mining animation settings:
- Non-looping (single swing)
- Tuned FPS (e.g., 10 FPS)
- Adds mining input:
- Input action:
use_pickaxemapped to Space
- Input action:
- Introduces mining state flag:
is_miningboolean prevents idle/run logic from overriding swing animation.- Mining causes:
- velocity set to zero
- early return from movement/animation processing until mining completes.
- Uses AnimatedSprite2D
animation_finishedsignal:- When swing finishes,
is_mining = false.
- When swing finishes,
Pickaxe hit detection (Area2D hitbox + rotation/offset)
- Adds mining hit detection:
- An Area2D named
hitbox - A CollisionShape2D (RectangleShape2D) inside it
- An Area2D named
- Hitbox is dynamically positioned/rotated to appear in front of the player:
- Stores initial
hitbox_offsetfrom editor settings - Updates based on
last_directionusingmatchon direction vectors - Adds rotation adjustments for up/down (e.g., 90 degrees)
- Stores initial
- Hitbox monitoring toggling:
hitbox.monitoring = falseduring normal animation loops- Set
trueonly insideuse_pickaxe()to avoid constant collision checks.
Rock identification & prioritization (closest overlap)
- Rocks are made distinguishable by
class_name:- Rock script sets
class_name = rock - Ore script sets
class_name = or(intent is consistent; subtitles may show a typo)
- Rock script sets
- Hitbox
body_enteredsignal:- Filters only detected bodies of type rock.
- Handles edge case where the hitbox overlaps multiple rocks:
- Adds
detected_rocks: Array - Clears it each swing
- Chooses the best target using distance:
get_most_overlapping()returns the closest rock by comparinghitbox.global_position.distance_to(rock.global_position).
- Adds
Damage, breaking, destruction
- Player has
pickaxe_strength(starts at 1). - Rock script:
- Stores health (
health) loaded from resourcemax_health - Implements
take_damage(amount):health -= amount- if
health <= 0→ destroy
_destroy():- uses
queue_free()to remove the rock node.
- uses
- Stores health (
Mining QoL: holding the key (cooldown timer)
- Adds a Timer node:
mining_timer- cooldown set to ~0.5 seconds
one_shot = true
- Changes mining input behavior:
is_action_pressed("use_pickaxe")with timer stopped conditionmining_timer.start()inuse_pickaxe()
- Result:
- Holding Space repeatedly swings at the cooldown rate.
Ore dropping (resources-based rock types)
Resource-driven rock/ore data model
- Rocks use a custom Resource:
rock_dataextendsResource- Exported fields:
texturemax_healthrarity(spawn weighting)min_depthor_data(linked ore resource)
- Each rock scene uses one script but different resource instances (stone/iron/etc.).
- Ores use a second custom Resource:
or_dataextendsResourcewith exports:nametexturevalue(sell/inventory value)
- Rock → ore linkage:
- Rock resource includes an
or_resourcereference - When breaking a rock, its ore data is passed to the ore instance so the ore sprite matches the rock type.
- Rock resource includes an
Ore scene + spawn positioning
- Creates an
orscene:- Area2D with Sprite2D and CollisionShape2D
- Rock script
_drop_or():- preloads
or_scene - instantiates ore at the rock position
- finds parent containers:
- adds rocks into
rock_container - ores into
or_container
- adds rocks into
- hides then destroys the rock as needed later.
- preloads
Visual polish: ore bounce + rock flash
- Ore spawn tween:
- Vertical bounce tween using Tween ease/trans (ease-out then ease-in)
- Random horizontal offset using
randf_range(-15, 15) - Tweens run in parallel via
set_parallel(true)
- Rock hit flash:
- Uses Sprite2D
modulateintensity increase then tweens back quickly (e.g., 0.1s).
- Uses Sprite2D
Audio polish: hit and breaking sounds
- Adds audio folders and imports two open-source sounds:
pickaxe hitrock breaking
- Player plays “pickaxe hit” only after confirming it hit a rock (typically on animation finished/mining resolution).
- Rock plays “rock breaking” before removal:
- Hide rock (
visible = false) - Disable collision shape using
set_deferred("disabled", true) await sound.finishedbeforequeue_free()- Prevents invisible colliders and avoids cutting off sound.
- Hide rock (
Map building (TileMap layers, terrains, props, markers)
- Builds a
base_mapscene template (inherited later). - Uses Godot 4 TileMap architecture:
- TileMapLayer for ground and props
- Terrain tools (terrain sets) for walkable ground edges and automatic tile connections
- Paint props using another tile set (e.g., railways)
- Adds:
player spawnas Marker2D- Camera2D that follows the player
- Fixes map aesthetics:
- Paint wall/edge/background tiles (using wall cave tile set) so you don’t see Godot default background.
Tile collision using physics layers
- In the tile set:
- Creates a Physics Layer
- Assigns collision shapes to non-walkable areas using the tile editor collision tools (polygon/grid snapping).
- Verifies:
- player cannot walk off edges (collision blocks movement at map boundaries).
Procedural rock generation (spawn only on valid ground tiles)
- Level script generates rocks automatically on
ready. - Steps:
- Clear existing rocks from
rock_container - Determine valid spawn positions:
- Add custom data layer to ground tile set:
can_spawn_rocks(boolean) - Iterate through ground layer “used cells”
- Exclude cells where the props layer is occupied (
get_cell_source_id != -1) - Add cells with
can_spawn_rocks == truetoavailable_cells
- Add custom data layer to ground tile set:
- Shuffle
available_cellsand choose rock count by fill percentage:- e.g.,
fill_percentage = 0.4 num_rocks = int(available_cells.size() * fill_percentage)
- e.g.,
- Instantiate and place rocks:
- convert tile cell coords → local/pixel coords with
ground_layer.map_to_local(cell) - place rocks into
rock_container
- convert tile cell coords → local/pixel coords with
- Position player at marker:
- read
player spawnMarker2D coordinates - call
player.reset(position)(reset function added to player script).
- read
- Clear existing rocks from
Review/tutor focus
- This is a complete beginner tutorial emphasizing:
- step-by-step Godot scene setup
- sprite sheet configuration
- input mapping
- signal-based animation state changes
- correct collision/hitbox design
- resource-driven content (rock/ore definitions)
- procedural spawning using TileMap cell data + custom tile data layers
- Repeatedly notes code organization:
- splitting physics/animation into functions to prevent the
physics_processmethod from getting messy.
- splitting physics/animation into functions to prevent the
Main speakers/sources
- Single instructor (voice-over/tutor):
- Author of “Make a Roguelite Mining Game in Godot 4 - Complete Beginner Tutorial”
- Mentioned as a free tutorial and linked Udemy full course.
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.