Skip to main content

Overview

Space Pong follows a standard Godot 4.3 project structure optimized for mobile development. The project is organized into three main directories for scenes, scripts, and sprites, with the main game configuration defined in project.godot.

Directory Layout

SpacePong/
├── project.godot          # Main project configuration
├── export_presets.cfg     # Export settings for Android APK
├── scenes/                # Scene files (.tscn)
│   ├── game.tscn         # Main game scene
│   ├── ball.tscn         # Ball entity
│   ├── player.tscn       # Player paddle entity
│   └── ball.gd           # Ball script (co-located)
├── scripts/               # Standalone GDScript files
│   └── player.gd         # Player controller script
└── sprites/               # All game assets
    ├── Bola.png          # Ball sprite
    ├── Raquete.png       # Paddle sprite
    ├── Asteroide1-6.png  # Asteroid decorations
    ├── Fundo1-6.png      # Background variations
    └── icon.svg          # App icon

Project Configuration

The project.godot file defines the core game settings:
config/name="SpacePong"
run/main_scene="res://scenes/game.tscn"
config/features=PackedStringArray("4.3", "Mobile")
config/icon="res://sprites/icon.svg"
The project uses Godot 4.3 and targets mobile platforms with the “Mobile” rendering method.

Display Settings

Space Pong uses a portrait-oriented mobile viewport:
window/size/viewport_width=460
window/size/viewport_height=720
window/stretch/aspect="keep_height"
The viewport is 460x720 pixels with keep_height aspect ratio preservation, ensuring consistent vertical gameplay across different screen sizes.

Input Configuration

The project defines a custom “Start” input action mapped to the spacebar:
Start={
  "deadzone": 0.5,
  "events": [InputEventKey(physical_keycode=32)]  # Spacebar
}
Built-in actions ui_left and ui_right are used for player movement.

Main Scene

The entry point is res://scenes/game.tscn, which serves as the main game scene containing:
  • Background: Space-themed sprite (Fundo6.png)
  • Player: Instanced player paddle scene
  • Ball: Instanced ball scene
  • Walls: Three StaticBody2D nodes (TopWall, LeftWall, RightWall)
  • Hole: Area2D node at the bottom for game over detection

Scenes Directory

Contains all .tscn scene files and the ball script (co-located with ball.tscn)

Scripts Directory

Standalone GDScript files, currently contains the player controller

Sprites Directory

All game assets including sprites, backgrounds, and the app icon

Export Configuration

Pre-configured Android export settings for APK generation

Asset Organization

The sprites directory contains 30+ files organized by category:

Gameplay Sprites

  • Bola.png: The game ball (circular sprite)
  • Raquete.png: The player paddle sprite

Visual Elements

  • Fundo1-6.png: Six background variations (4KB each)
  • Asteroide1-6.png: Six asteroid decorations (~3.5KB each)
  • icon.svg: Vector app icon
All PNG assets include .import files generated by Godot’s import system for texture optimization.

Resource Paths

Godot uses the res:// protocol for resource paths:
# Scene references
res://scenes/game.tscn      # Main scene
res://scenes/player.tscn    # Player prefab
res://scenes/ball.tscn      # Ball prefab

# Script references
res://scenes/ball.gd        # Ball controller
res://scripts/player.gd     # Player controller

# Asset references
res://sprites/Bola.png      # Ball texture
res://sprites/Raquete.png   # Paddle texture
res://sprites/Fundo6.png    # Background texture

Build Output

The project includes pre-built Android APKs:
  • SpacePong.apk: Main Android package (24.3 MB)
  • SpacePong.apk.idsig: APK signature file (198 KB)
The .godot directory contains editor cache and should not be manually modified or committed to version control.

File Organization Strategy

1

Scene Files

All scene files (.tscn) are stored in the scenes/ directory. The ball script is co-located here.
2

Scripts

Standalone scripts go in scripts/. Scripts tightly coupled to scenes (like ball.gd) can be co-located.
3

Assets

All visual assets are centralized in sprites/, regardless of type (backgrounds, sprites, icons).
4

Configuration

Project-level configuration files (project.godot, export_presets.cfg) remain in the root directory.

Next Steps

Scenes

Explore the scene hierarchy and structure

Scripts

Learn about the GDScript implementation

Build docs developers (and LLMs) love