AJP Report
AJP Report
Micro Project On
Submitted By
Under Guidance of
Ms. K. S. Jadhav
Sinhgad Institutes
Sinhgad Technical Education Society’s
SOU. VENUTAI CHAVAN POLYTECHNIC, PUNE - 411041
ACADEMIC YEAR 2024 -2025
Maharashtra State Board of technical
Education Certificate
This is to certify that Ms. Janhavi Amit Shinde with Roll No. 50
of Fifth Semester of Diploma in Information Technology of
Institute Sou. Venutai Chavan Polytechnic (Code:0040) has
successfully completed the Micro-Project in Advanced Java
Programming (22517) for the academic year 2024- 2025.
A. BRIEF INTRODUCTION:
This Java Flappy Bird game uses Swing for graphics and Oracle JDBC to manage high scores. The player
controls a bird, avoiding pipes by pressing spacebar to jump. It includes lifelines, gravity mechanics, and
collision detection, with dynamic pipe generation, scoring, and high score tracking stored in a database for
a complete gameplay experience.
The aim of the project is to develop a Java-based Flappy Bird game with real-time mechanics, including
scoring, lifelines, and database-integrated high score tracking.
D. RESOURCES REQUIRED:
Name of Resource
Sr . No. Specification
Required
1 Laptop Intel (R) Core i5- 8GB RAM
2 Operating system Windows 11
3 Software VS Code
ACTION PLAN:
GROUP MEMBERS:
The process for this micro project is to make a “Flappy Bird Game.”
We collect information and organize by following points:
1. Collect the information on how to develop a report.
2. Show the information to faculty.
3. Learn about advanced java.
4. First make a raw report and then correct it.
5. After all the corrections make a proposal.
6. Then prepare a project on “Flappy Bird Game.”
7. Make pdf of report and print it.
8. We learn more about Advanced Java Programming.
ANNEXURE III
Evaluation Sheet for the Micro Project
Academic Year: 2024-2025 Name of the Faculty: Ms. K. S. Jadhav
S. No Course Outcomes
ALGORITHM:
1. Initialize game variables, including board dimensions, lifelines, and images for the background, bird,
and pipes.
2. Establish a database connection to retrieve and prepare to update the high score.
3. Create the bird object and initialize an empty list for pipes.
4. Set up and start timers for placing pipes and updating the game loop.
5. Define the pipe placement method to generate new pipes at random heights.
6. Override the `paintComponent` method to draw the game components on the screen.
7. In the game loop, apply gravity to the bird's position and move pipes horizontally.
8. Update the score when the bird successfully passes a pipe.
9. Implement collision detection to manage interactions between the bird and pipes.
10. If the game ends, stop timers and display a game over message, updating the high score if applicable.
11. If a lifeline is available after a collision, reset the game without starting over.
CODE:
FlappyBird.java
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.*;
import java.sql.*;
Image backgroundImg;
Image birdImg;
Image topPipeImg;
Image bottomPipeImg;
class Bird {
int x = birdX;
int y = birdY;
int width = birdWidth;
int height = birdHeight;
Image img;
Bird(Image img) {
this.img = img;
}
}
class Pipe {
int x = pipeX;
int y = pipeY;
int width = pipeWidth;
int height = pipeHeight;
boolean collided;
Image img;
boolean passed = false;
Pipe(Image img) {
this.img = img;
}
}
Bird bird;
int velocityX = -4; //move pipes to the left speed
int velocityY = 0; //move bird up or down
int gravity = 1;
ArrayList<Pipe> pipes;
Random random = new Random();
Timer gameLoop;
Timer placePipeTimer;
boolean gameOver = false;
double score = 0;
PreparedStatement pstmt;
Statement stmt;
int hs;
FlappyBird() {
setPreferredSize(new Dimension(boardWidth, boardHeight));
setFocusable(true);
addKeyListener(this);
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","system");
System.out.println("Connection Established!");
pstmt = con.prepareStatement("update highscore set hs=?"); //used to assign valus dynamically like
the highscore for instance
stmt = con.createStatement();// retrive current highscore
ResultSet rs = stmt.executeQuery("select hs from highscore");
rs.next();
hs = rs.getInt(1);
}catch(Exception e){}
void placePipes() {
int randomPipeY = (int) (pipeY - pipeHeight/4 - Math.random()*(pipeHeight/2));
int openingSpace = boardHeight/4;//space for bird to fly
}
}catch(Exception e)
{
System.out.println("Exception in HighScore Database!");
System.err.println(e);
}
}
}
if (collision(bird, pipe)) {
if (lifeline > 0 && !pipe.collided) {
System.out.println("Lifeline: " + lifeline);
lifeline--;
pipe.collided = true;//prevent mul reductions
resetGameAfterCollision();
} else if (lifeline == 0) {
gameOver = true;
placePipeTimer.stop();
gameLoop.stop();
}
}
}
if (bird.y > boardHeight) {
if (lifeline > 0) {
lifeline--;
resetGameAfterCollision(); // Reset game after bird falls
} else {
gameOver = true;
placePipeTimer.stop();
gameLoop.stop();
}
}
}
void resetGameAfterCollision() {
bird.y = birdY;
velocityY = 0;
pipes.clear();
}
Starting interface:
Interface when the player crosses score 15:
In conclusion, the Flappy Bird project successfully demonstrates key programming concepts in Java,
including GUI design, event handling, and database integration. By combining these elements, the game
offers an engaging user experience that enhances skills in real-time application development. The project
not only reinforces theoretical knowledge but also provides practical insights into game mechanics and
database management, making it a valuable learning experience for aspiring developers.
References:
1. https://www.oreilly.com/library/view/java-swing-2nd/0596004087/
2. https://www.geeksforgeeks.org/what-is-advanced-java/
3. https://www.w3schools.com/java/