You are on page 1of 14

MICRO-PROJECT

“ Flappy Bird Game using Java, Java Swing, Java AWT, and OOPS”

Submitted- 2023-24

This micro-project work submitted in partial fulfillment of requirements for the award of
diploma in Computer Technology for subject "JavaAdvanced programing "()”.

Computer Engineering

Maharashtra State Board of Technical Education, Mumbai

UNDER THE GUIDANCE OF

Lect.Prof.Ashirwad Ramteke

Lect. In Computer Technology

SUBMITTED BY

Sr
no Roll no. Name of Student Enrollment
. no.
1. 54 Harshal.R.Ukey 2101210133
DEPARTMENT OF COMPUTER ENGINEERING

GOVERNMENT POLYTECHNIC, BRAMHAPURI DIST CHANDRAPUR

DEPARTMENT OF COMPUTER ENGINEERING


Certificate

This is to certify that the following student of this institute have carried out this micro-
project in work ““ Flappy Bird Game using Java, Java Swing, Java AWT, and
OOPS”” Under the guidance of Prof.Ashirwad ramteke Lect. in the Department of
Computer Engineering during the session 2022-2023 This work has been in the partial
fulfillment of the award for Diploma in Computer Engineering from Maharashtra State
Board of Technical Education, Mumbai.

SUBMITTED BY

Sr
no Roll no. Name of Student Enrollment
. no.

1. 54 Harshal.R.Ukey 2101210133

Project Guide Head of department Principle

Prof.Ashirwad Ramteke Prof. S. K. Kharkate Prof.


Part-A
“ Flappy Bird Game using Java, Java Swing, Java AWT, and OOPS”

1.0 .Aim of micro project:-

2.0 . Brief introduction:


This Java program Develop by A Graphical User Interface (GUI) is a visual way for
users to interact with computers and software. It utilizes graphical elements such as
windows, icons, buttons, and menus to facilitate user interactions. GUIs enhance user
experience by providing a more intuitive and user-friendly environment, allowing
users to perform tasks through visual representations.

3.0Course outcome:

• Develop A programing using GUI framework (AWT Swing).


• Handling Event of AWT and Swing components.

4.0 Literature review:


● The Information about the topic was collected from different source such as
different sites. As well as using web links. Also we discussed the topic with
subject related teacher. Also in lecture our subject teacher gives us information
about this project.

5.0Proposed methodology:

The working methodology is as follows:-

▪ Search for topic suitable


▪ Select topic which address our course outcomes.
▪ Selected topic discussed with project guide Prof.Ashirwad Ramteke
▪ Collect information, resources and references which is required throughout.
▪ Started working over the micro project with same preparing report.
▪ After all finishing work report submitted to respective project guide
6.0 Action plan:

Sr Detail of Activity Start Finish Name of student


. Date Date
no
.

1 Search for topic Harshal .R.Ukey

Information search and Harshal .R.Ukey


resource collected
2

3 Implement part-A Harshal .R.Ukey

4 Work over project Harshal .R.Ukey

5 Implement part-B Harshal .R.Ukey

6 Submission of final report Harshal .R.Ukey

3.0 Resource required:

Sr. Name of
no. resource/materia specification Quantity Purpose
l
1. Internet Gives As per To get
information requirement information- on
and pictures.
2. Laptop Asus-Tuf 1 To make micro
project.
3. Book Business 1 To get
communication information- on
4. Software Jdk-7.0 1 To develop the
program
Part :-B
“ Flappy Bird Game using Java, Java Swing, Java AWT, and OOPS”
1.0 Rationale:- Rationality, pivotal in decision-making, fosters logical thinking by
considering facts, minimizing biases, and maximizing utility. It aids problem-solving
and efficient resource allocation. In societal contexts, rationality shapes policies and
ethical considerations, steering progress. In personal realms, it promotes sound
judgments, enhancing individual growth. Rationality is a cornerstone, fostering clarity
and coherence in various domains, enabling optimal choices and outcomes.

2.0 Aim of Micro-project:


“ Flappy Bird Game using Java, Java Swing, Java AWT

3.0 Course outcomes Achieved:


• Basic Java Proficiency
• Graphical User Interface (GUI) Development
• Event Handling Mastery
• Input Validation and Error Handling
• Layout Management Knowledge

4.0 Actual Methodology followed:


● Search for topic suitable to Microprocessor microproject.
● Select topic which address over course outcome.
● Selected topic discussed with project guide Prof.Ashirwad Ramteke
● Collect information, resources and references which is required throughout project
5.0 Resources used:

Name of Specification
Resource/Material
Laptop SSD 512GB, RAM 8 GB ,Rayzen7
processor
Software Ms-Word ,Chrome Browser ,
Jdk-7.0,Notepad ,Etc.
Other Accessories Reference Book

6.0 Skill Developed:

1. Java Fundamentals: The program demonstrates a solid understanding of core


Java concepts, such as data types, variables, arithmetic operations, and exception
handling (Number Format Exception).
2. Swing GUI Development: It showcases skills in creating graphical user interfaces
using Java Swing components like JFrame, JPanel, Label, JTextField, and JButton.
3. Layout Management: The program uses Grid Bag Layout to manage the
arrangement of components within the user interface. It also uses Grid Bag
Constraints to specify layout constraints, including component placement and
spacing.
4. Event Handling: The program implements event handling for button clicks (doIt.
Add Action Listener(this)) and text field actions (action Performed(Action Event
ae)), demonstrating proficiency in handling user interactions.
5. Input Validation: It validates user input by checking for empty fields and
handling Number Format Exception exceptions gracefully when parsing text input
to double values.
6. Application Packaging: The code includes a main method that allows the
program to be run as a standalone application, showing familiarity with packaging
Java applications.
7. User Interface Design: While the user interface is relatively basic, it demonstrates
skills in designing and organizing components within a window for a user-friendly
experience.
7.0. Reference:-
1. Internet is a best option for information's.
2. We take all information Chat gpt (Open AI Playground)
3. Books:-Java Advanced

8.0. Conclusion:-

The provided Java program, which calculates monthly loan payments, serves as a
foundational example of Java Swing GUI development and basic mathematical
computation. It demonstrates core Java concepts, GUI design, event handling, input
validation, and error handling.

In summary, this program showcases the ability to:

1. Create a simple GUI application using Java Swing components.

2. Manage component layout and alignment within a window.

3. Handle user interactions with buttons and text fields.

4. Validate user input and respond to errors gracefully.


2.1.Program :-

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

class FlappyBirdGame extends JPanel implements ActionListener, KeyListener {

private Timer timer;

private int birdY, velocity;

private boolean isGameOver;

private int gap, birdHeight, initialBirdY;

private int obstacleX, obstacleWidth, obstacleGap, obstacleSpeed;

public FlappyBirdGame() {

// Set initial values for game elements

gap = 150;

birdHeight = 20;

initialBirdY = 150;

obstacleX = 300;

obstacleWidth = 50;

obstacleGap = 150;

obstacleSpeed = 5;

// Set up the game window


JFrame frame = new JFrame("Flappy Bird");

frame.setSize(800, 600);

frame.add(this);

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setVisible(true);

frame.addKeyListener(this);

// Initialize game variables

birdY = initialBirdY;

velocity = 0;

isGameOver = false;

// Create a timer to update game

timer = new Timer(20, this);

timer.start();

@Override

public void paintComponent(Graphics g) {

super.paintComponent(g);

g.setColor(Color.CYAN);

g.fillRect(0, 0, getWidth(), getHeight());


g.setColor(Color.GREEN);

g.fillRect(obstacleX, 0, obstacleWidth, birdY - gap / 2);

g.fillRect(obstacleX, birdY + gap / 2, obstacleWidth, getHeight() - birdY - gap /


2);

g.setColor(Color.RED);

g.fillRect(100, birdY - birdHeight / 2, 30, birdHeight);

if (isGameOver) {

g.setColor(Color.BLACK);

g.drawString("Game Over", 350, 300);

@Override

public void actionPerformed(ActionEvent e) {

birdY += velocity;

if (!isGameOver) {

if (birdY > getHeight() || birdY < 0) {

isGameOver = true;

obstacleX -= obstacleSpeed;
if (obstacleX < -obstacleWidth) {

obstacleX = getWidth();

if (obstacleX <= 130 && obstacleX >= 70) {

if (birdY - gap / 2 < 0 || birdY + gap / 2 > getHeight()) {

isGameOver = true;

repaint();

@Override

public void keyTyped(KeyEvent e) {}

@Override

public void keyPressed(KeyEvent e) {

if (e.getKeyCode() == KeyEvent.VK_SPACE && !isGameOver) {

velocity = -10;

@Override
public void keyReleased(KeyEvent e) {

if (e.getKeyCode() == KeyEvent.VK_SPACE) {

velocity = 5;

public static void main(String[] args) {

new FlappyBirdGame();

}
Output:-
Conclusion

Conclusion for a Flappy Bird Game developed using Java, Java Swing, Java AWT, and
OOP principles:

1. Object-Oriented Design: Leveraging OOP concepts enhanced code modularity and


scalability.

2. Java Swing and AWT: These libraries facilitated interactive GUI components,
enabling smooth gameplay and user engagement.

3. Code Efficiency: Java's robustness streamlined game logic, ensuring responsive


controls and an immersive experience.

4. Challenges: Overcoming complexities in collision detection and physics added depth


to the learning experience.

5. Overall, the project showcases effective utilization of Java, Swing, AWT, and OOP,
culminating in a functional and enjoyable Flappy Bird game.

You might also like