Skip to content

codeforgood-org/godot-coin-collector

Repository files navigation

Coin Collector 🪙

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!

Godot Version License

📖 About

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!

✨ Features

  • 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

🎮 How to Play

  1. Move: Use arrow keys or WASD to move the player (green square)
  2. Collect: Touch the yellow coins to collect them
  3. Win: Collect all 10 coins to win the game
  4. Restart: Click the restart button to play again

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/codeforgood-org/godot-coin-collector.git
    cd godot-coin-collector
  2. Open in Godot

    • Launch Godot Engine
    • Click "Import"
    • Navigate to the cloned directory
    • Select project.godot
    • Click "Import & Edit"
  3. Run the game

    • Press F5 or click the "Play" button in the top-right corner

📁 Project Structure

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

🎨 Customization

Changing Player Speed

Edit scripts/player.gd:

@export var speed: float = 200.0  # Increase for faster movement

Changing Number of Coins

Edit scripts/main.gd:

@export var coin_count: int = 10  # Change to desired number

Changing Colors

Edit the respective scene files or modify the script properties:

  • Player color: scripts/player.gdplayer_color
  • Coin color: scripts/coin.gdcoin_color

🛠️ Development

Code Structure

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

Adding New Features

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

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with Godot Engine
  • Created for educational purposes by Code for Good

📞 Support

If you encounter any issues or have questions:


Happy coding! 🎮✨

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •