"Can you run fast enough to survive? Or will you croak?"
Welcome to Run or Croak, a fast-paced 2D action game where you control a daring character trying to avoid obstacles and collect points. Dodge bees, jump over traps, and see how far you can go as the game gets faster and harder!
- 🎮 Game Overview
- 🚀 How to Run the Game
- ⚙️ Principles and Design Patterns
- 📜 Game Instructions
- 💻 Technologies Used
- ✨ Credits
Your goal is simple: survive as long as possible! Control your character as they run through a dangerous path, dodging obstacles and collecting items to maximize your score.
- Dynamic Difficulty: The game gets harder as you play. Obstacles spawn faster, and the speed increases!
- Smooth Animations: Enjoy fluid character movements and polished obstacle animations.
- Lives System: You start with 3 lives. Once you lose them all... it's Game Over!
- Collision Detection: Careful! Touch an obstacle and you'll lose a life.
- Charming Graphics: Featuring pixel art visuals and a retro vibe.
- Sound Effects: Immersive background music and sound effects add to the fun.
- Intro Screen: A welcoming start to set the mood.
- Title Screen: Start the game, see your best score, or adjust settings.
- Playing Mode: The main action takes place here — run or croak!
- Game Over Screen: Shows your final score and lets you restart.
-
Download the game:
- ⬇️ Download
run-or-croak.jar
- ⬇️ Download
-
Install Java: Ensure you have Java JRE 8 or higher installed on your system. Get Java here.
-
Run the game: Open a terminal and use the following command:
java -jar RunOrCroak.jar
If you'd like to explore or modify the code, follow these steps:
-
Install Java JDK:
-
Install "Java Extension Pack": If you are using Visual Studio Code, go to the Extensions view (
Ctrl+Shift+XorCmd+Shift+Xon macOS) and search for "Java Extension Pack." -
Clone the repository:
git clone https://github.com/your-username/RunOrCroak.git
-
Compile and run:
javac -d bin -sourcepath src src/game/main/Game.java java -cp bin game.main.Game
The game was built with clean coding principles and utilizes multiple software design patterns for flexibility and scalability:
The game continuously updates and renders in a loop:
- Update: Game state, player movements, and obstacle positions.
- Render: Draws all visual elements to the screen.
The game adheres to the Model-View-Controller (MVC) pattern:
- Model: Handles the game logic (score, obstacles, etc.).
- View: Renders the game graphics (character, UI, etc.).
- Controller: Manages player inputs like key presses.
The EntityFactory class dynamically generates obstacles and items, ensuring modular and scalable code.
The SoundPlayer class ensures that only one instance of sound effects and background music is active at any time.
Manages the game's transitions between states (Intro, Title, Playing, Game Over) smoothly and efficiently.
- Start the Game:
- Launch the game and press
Spacebaron the Title Screen to begin!
- Launch the game and press
- Controls:
- ⬆️ Spacebar: To jump over the obstacles!
- ⬇️ Down Arrow: Slide right under those pesky enemies.
- Objective: Avoid obstacles, collect items, and survive as long as you can.
- Game Over: When you lose all your lives, your final score will be displayed.
- Restart: Press
Enterafter the game ends to start over.
Tip: Watch out for those pesky bees—they’ll follow you around!
This project uses a combination of Java tools and libraries:
- Java: Core language for game logic and rendering.
- Swing: For the graphical user interface (GUI).
- ImageIO: To load sprites and animations.
- Animator: Custom class to handle smooth frame-based animations.
- SoundPlayer: Plays background music and sound effects.
- IDE: Visual Studio Code
- JDK: Version 8 or higher
- External Libraries: Custom fonts and assets