A simple and fun 2D coin collection game built with Godot Engine 4.3. Control a player character to collect all the coins scattered across the screen!
Coin Collector is a beginner-friendly game project that demonstrates core game development concepts including:
- Player movement and input handling
- Collision detection
- Score tracking and UI management
- Modular code architecture
- Signal-based communication between nodes
Perfect for learning Godot or as a foundation for more complex games!
- Smooth Movement: Control the player with arrow keys or WASD
- Score Tracking: Real-time score display showing collected coins
- Win Condition: Collect all coins to win the game
- Restart Functionality: Quick restart button to play again
- Modular Design: Clean, well-organized code structure
- Documented Code: Comprehensive comments and documentation
- Move: Use arrow keys or WASD to move the player (green square)
- Collect: Touch the yellow coins to collect them
- Win: Collect all 10 coins to win the game
- Restart: Click the restart button to play again
- Godot Engine 4.3 or later
-
Clone the repository
git clone https://github.com/codeforgood-org/godot-coin-collector.git cd godot-coin-collector -
Open in Godot
- Launch Godot Engine
- Click "Import"
- Navigate to the cloned directory
- Select
project.godot - Click "Import & Edit"
-
Run the game
- Press
F5or click the "Play" button in the top-right corner
- Press
godot-coin-collector/
├── scenes/ # Godot scene files
│ ├── main.tscn # Main game scene
│ ├── player.tscn # Player character scene
│ ├── coin.tscn # Coin collectible scene
│ └── hud.tscn # User interface scene
├── scripts/ # GDScript files
│ ├── main.gd # Main game controller
│ ├── player.gd # Player movement logic
│ ├── coin.gd # Coin behavior
│ └── hud.gd # UI management
├── assets/ # Game assets
│ ├── sprites/ # Sprite images
│ ├── sounds/ # Sound effects and music
│ └── fonts/ # Font files
├── docs/ # Additional documentation
├── .gitignore # Git ignore file
├── LICENSE # MIT License
├── project.godot # Godot project configuration
└── README.md # This file
Edit scripts/player.gd:
@export var speed: float = 200.0 # Increase for faster movementEdit scripts/main.gd:
@export var coin_count: int = 10 # Change to desired numberEdit the respective scene files or modify the script properties:
- Player color:
scripts/player.gd→player_color - Coin color:
scripts/coin.gd→coin_color
The project follows a modular architecture:
- main.gd: Orchestrates the game, spawns coins, handles collisions
- player.gd: Self-contained player movement logic
- coin.gd: Coin behavior with signal-based collection
- hud.gd: UI updates and restart functionality
Some ideas for enhancement:
- Add obstacles or enemies
- Implement a timer for time-based challenges
- Add sound effects and background music
- Create multiple levels with increasing difficulty
- Add power-ups or special coins
- Implement particle effects for coin collection
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Godot Engine
- Created for educational purposes by Code for Good
If you encounter any issues or have questions:
- Open an issue on GitHub Issues
- Check the Godot Documentation
Happy coding! 🎮✨