Hide and Seek Game is a Java-based game that features a battle between red droids (hunters) and a green droid (hider) in a randomly generated maze.
- Randomly Generated Maze: Each game has a unique maze generated using a recursive backtracking algorithm.
- Red and Green Droids: Red droids act as hunters, while the green droid tries to hide.
- Simple AI: Red droids use a BFS (Breadth-First Search) algorithm to find the shortest path to the green droid.
- Game Controls: Buttons to start, stop, randomize the map, and randomize droid positions.
- Droid Count Management: Ability to add or remove red droids.
- Adjustable Vision Range: Slider to set the green droid's vision range.
- View Modes: Buttons to toggle between red and green droid views.
- Java Development Kit (JDK) 8 or higher
- Java Swing Library
- Compile the Java file:
- Run the program:
- Click the "Mulai" (Start) button to begin the game.
- Use the "Acak Map" (Randomize Map) button to generate a new maze.
- Use "Acak Droid Merah" (Randomize Red Droid) and "Acak Droid Hijau" (Randomize Green Droid) buttons to change droid positions.
- Adjust the number of red droids with "Tambah Droid Merah" (Add Red Droid) and "Kurangi Droid Merah" (Remove Red Droid) buttons.
- Use the slider to adjust the green droid's vision range.
- Use "Pandangan Droid Merah" (Red Droid View) and "Pandangan Droid Hijau" (Green Droid View) buttons to switch between view modes.
- The game ends when a red droid captures the green droid.
HideAndSeek
: Main class that sets up the game board and controls.Droid
: Class representing the droids with movement logic.Node
: Helper class for pathfinding algorithm.
generateMaze()
: Creates a random maze using recursive backtracking.moveDroids()
: Handles the movement of all droids.bfs()
: Implements Breadth-First Search for red droid pathfinding.paintComponent()
: Renders the game board and droids.
Contributions are always welcome. Please fork this repository, make your changes, and submit a pull request for any improvements or additional features.
This project is licensed under the MIT License. See the LICENSE
file for details.
For questions or suggestions, please contact:
- Email: adamvinandra767@gmail.com