Skip to main content

Overview

Turtle Run is a landscape-oriented endless runner where players navigate a turtle across three lanes, dodging obstacles and collecting bonuses. Speed increases progressively every 6 seconds, creating an escalating challenge. Scene Path: res://minigames/turtle_run/scripts/Main.gd

Cognitive Skills Developed

  • Reaction Time: Quick lane-switching decisions
  • Spatial Awareness: Tracking obstacles across 3 lanes
  • Sustained Attention: Maintaining focus as speed increases
  • Decision Making: Risk/reward with bonus items

How to Play

Controls

  • Touch/Click: Tap lanes to move turtle up or down
  • Swipe: Quick swipe for lane changes
  • Back Button: Pause game

Objective

Survive as long as possible while maximizing score through distance and bonus collection.

Gameplay

  1. Start: Tap “Play” on the intro screen
  2. Navigate: Switch between 3 lanes (y-positions: 100, 160, 220)
  3. Avoid: Dodge obstacles spawning from the right
  4. Collect: Grab bonus items for extra points
  5. Survive: Game ends on collision with obstacle

Scoring System

Base Score

score += delta * 10 * speed_multiplier
Points accumulate continuously based on time survived and current speed multiplier.

Bonus Items

  • Spawn Rate: 10% chance (vs 90% obstacles)
  • Points: Configurable via add_score_bonus(amount)
  • Default Bonus: +50 points per item

Coin Conversion

var coins_earned = int(final_score * 0.1)
score_manager.add_coins(coins_earned)
Coins = 10% of final score

Difficulty Progression

Speed Increase

var speed_increase_interval := 6.0
var speed_multiplier := 1.0

elapsed_time += delta
if elapsed_time >= speed_increase_interval:
    elapsed_time = 0
    speed_multiplier *= 1.1  # 10% faster every 6 seconds

Spawn Rate

spawn_timer.wait_time = randf_range(0.5, 1.5)
Obstacles/bonuses spawn every 0.5-1.5 seconds, with spawn rate staying constant as speed increases.

Lane Selection

var lanes_available = lanes.duplicate()
if last_lane != -1:
    lanes_available.erase(last_lane)
    
var lane_y = lanes_available.pick_random()
Prevents consecutive spawns in the same lane for fairer gameplay.

Key Code Examples

Obstacle Spawning Logic

func _on_SpawnTimer_timeout() -> void:
    if is_paused or is_intro:
        return

    spawn_timer.wait_time = randf_range(0.5, 1.5)
    spawn_timer.start()

    var lanes_available = lanes.duplicate()
    if last_lane != -1:
        lanes_available.erase(last_lane)

    var lane_y = lanes_available.pick_random()
    last_lane = lane_y

    if randf() < 0.9:
        spawn_obstacle(lane_y)
    else:
        spawn_bonus(lane_y)

func spawn_obstacle(y_pos: float) -> void:
    var obstacle = obstacle_scene.instantiate()
    obstacle.position = Vector2(get_viewport_rect().size.x + 50, y_pos)
    obstacle_container.add_child(obstacle)

Parallax Scrolling

func _process(delta: float) -> void:
    if is_paused or is_intro:
        return
    
    parallax.scroll_offset.x -= scroll_speed * speed_multiplier * delta
    score += delta * 10 * speed_multiplier

Animation Speed Sync

var turtle = get_node_or_null("Turtle")
if turtle:
    turtle.update_animation_speed(speed_multiplier)
Turtle animation speed increases with game speed for visual consistency.

Game Over Flow

func game_over() -> void:
    spawn_timer.stop()
    scroll_speed = 0
    set_process(false)

    # Freeze all entities
    for node in obstacle_container.get_children():
        node.set_process(false)
    
    play_hit_sound()
    await get_tree().create_timer(0.8).timeout
    
    # Save score and award coins
    var final_score = int(score)
    if final_score > 0:
        score_manager.save_high_score("turtle_runner", final_score)
        var coins_earned = int(final_score * 0.1)
        score_manager.add_coins(coins_earned)
    
    _show_game_over()

Screen Orientation

DisplayServer.screen_set_orientation(DisplayServer.SCREEN_LANDSCAPE)
get_tree().root.set_content_scale_size(Vector2i(480, 270))
Turtle Run uniquely uses landscape orientation for horizontal scrolling gameplay.

Audio System

  • Bonus Sound: $AudioBonus - Plays on item collection
  • Hit Sound: $AudioHit - Plays on collision
  • Pause Handling: Audio streams pause/resume with game state
  • Turtle Node: Player character with lane-switching logic
  • Obstacle Scene: Hazards that end game on collision
  • Bonus Scene: Collectible items for extra points
  • FloatingText Scene: Visual feedback for score changes

Food Catch

Another reaction-based minigame with vertical movement

Minigames Overview

Return to all minigames

Build docs developers (and LLMs) love