A simple Flappy Bird clone written in Java using javax.swing
and java.awt
.
This project demonstrates basic game programming concepts such as animation, collision detection, and user input handling.
- Classic Flappy Bird gameplay mechanics
- Simple graphics rendering with Java Swing
- Keyboard controls (spaceBar to flap)
- Basic collision detection with pipes and ground
- Score tracking
- JSON parsing with Gson for sprite configuration (new)
Game Menu | Gameplay |
---|---|
![]() |
![]() |
- Game Over Screen
- Open the project folder in IntelliJ IDEA.
- Make sure your Project SDK is set to JDK 21 or higher.
- Build the project (
Build > Build Project
). - Run the main class
flappybird.core.FlappyBird
(right-click > Run).
- Install the Java Extension Pack.
- Ensure your Java version is JDK 21 or higher (
java -version
). - Configure
.vscode/settings.json
if needed:
{
"java.project.sourcePaths": ["src/main/java"],
"java.project.outputPath": "target/classes"
}
- Reload the workspace and build the project.
- Run
flappybird.core.FlappyBird
(right-click > Run Java).
-
Make sure you have JDK 21 set as your
JAVA_HOME
. -
Run:
mvn clean compile mvn exec:java -Dexec.mainClass="flappybird.core.FlappyBird"
Note: If you are using a Java version between 14 and 21, make sure to update your Maven compiler plugin to specify the correct source and target versions in your
pom.xml
. For example:<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.13.0</version> <configuration> <source>14</source> <target>14</target> </configuration> </plugin> </plugins> </build>This ensures your project compiles correctly if your JDK is lower than 21 but at least 14 or higher.
- SpaceBar or Left Mouseclick — Make the bird flap (jump)
- Escape — Return to Menu
- Java Standard Edition (JDK 21 or higher)
- Gson (for JSON parsing, managed by Maven)
This project is open source and free to use under the MIT License.