Project Flappy
Project Flappy
ON
“FLAPPY BIRD”
Submitted for the partial fulfillment of the requirement for the
4TH semester
Bachelor of Technology
in
COMPUTER SCIENCE & ENGINEERING-
ARTIFICIAL INTELLIGENCE
By
Student Name: Debadutta Dash RegNo: 2201287469
Student Name: Dishant ku. Mohapatra RegNo:2201287477
Student Name: Dibya Jyoti Parida RegNo: 2201287474
Student Name: Suvranshu Sekhar Behera RegNo: 2321287028
Supervised By:
Prof. Bimal prasad kar
1
APR 2024
a) Research Based:
b) Development Based:
1.
i) The game speed increases as the score rises, making it progressively more challenging.
ii) There are a limited number of lives, and the game ends when all lives are lost.
iii) Include power-ups that grant the bird temporary abilities, like invincibility or increased flight duration.
Certificate
This is to certify that the mini project report entitled “Title of the project”
submitted by
is an authentic work carried out by them at GITA under my guidance. The matter embodied
in this project work has not been submitted earlier for the award of any degree or diploma to
the best of my knowledge and belief.
3
Prof. (Dr.) Prasanta Kumar Bal
(H.O.D, Dept. Of CSE-AI)
(Supervisor)
ACKNOWLEDGEMENT
I express and gratitude to Prof. Bimal prasad kar, project supervisor for his
guidance and constant support.
I also take this opportunity to thank Prof. (Dr.) Prasanta Kumar Bal,head of
Department, Computer Science & Engineering, for his constant support and
timely advice.
Lastly, words run to express my gratitude to all the faculties of the CSE Dept.
and friends for their support and co-operation, constructive criticism and
valuable suggestion during preparation of this project report.
Thanking All…
4
ABSTRACT:-
Flappy Bird game in Python using Pygame. Players control a bird, navigating it through
pipes to score points. Pygame is used for visuals, and core mechanics include gravity,
collision detection, and scoring gameplay includes Players controling a bird, avoiding
pipes and the ground to score points. The bird will be represented by a sprite image
with flapping animation to create a sense of flight. Physics will be applied to simulate
gravity, affecting the bird's vertical movement. Pipes will be implemented as two
separate images, one for the top section and one for the bottom, creating a gap for the
bird to fly through. Pairs of pipes will be generated randomly at set intervals and move
horizontally across the screen at a constant speed.A simple background image will be
used to create a visually appealing environment for the game.The ground will be
represented by a solid object at the bottom of the screen. Collisions with the ground will
result in a game over state.Points will be awarded for each pair of pipes successfully
passed. The score will be displayed on the screen.The player will control the bird's flight
using a keyboard key. Pressing the key will add an upward force to the bird,
counteracting gravity for a short duration.The bird's position will be updated based on
its current coordinates, velocity (affected by gravity and player input), and time
elapsed. Pipes will move horizontally across the screen at a constant speed,Collision
detection will be implemented to check for any contact between the bird and the pipes
or the ground,A collision will result in a game over state,the game will run in a
continuous loop, updating the positions of the bird, pipes, and any other game elements.
It will also handle player input, collision detection, scorekeeping, and rendering the
game visuals on the screen.Upon collision, the game will transition to a game over state,
displaying the final score and providing options to restart or exit the game.The game
will utilize Pygame's functionalities to create a visually appealing experience.Sprites:
Image files will be used to represent the bird, pipes, background, and any other visual
elements
5
CONTENTS
Chapter 5: References.
6
Aim of this project work
This document outlines a Flappy Bird game in Python using Pygame. Players
control a bird, navigating it through pipes to score points. Pygame is used for
visuals, and core mechanics include gravity, collision detection, and scoring
gameplay includes Players controling a bird, avoiding pipes and the ground
to score points. The bird will be represented by a sprite image with flapping
animation to create a sense of flight. Physics will be applied to simulate
gravity, affecting the bird's vertical movement. Pipes will be implemented as
two separate images, one for the top section and one for the bottom, creating
a gap for the bird to fly through. Pairs of pipes will be generated randomly at
set intervals and move horizontally across the screen at a constant speed.A
simple background image will be used to create a visually appealing
environment for the game.The ground will be represented by a solid object
at the bottom of the screen. Collisions with the ground will result in a game
over state.Points will be awarded for each pair of pipes successfully passed.
The score will be displayed on the screen.The player will control the bird's
flight using a keyboard key. Pressing the key will add an upward force to the
bird, counteracting gravity for a short duration.The bird's position will be
updated based on its current coordinates, velocity (affected by gravity and
player input), and time elapsed. Pipes will move horizontally across the
screen at a constant speed,Collision detection will be implemented to check
for any contact between the bird and the pipes or the ground,A collision will
result in a game over state,the game will run in a continuous loop, updating
the positions of the bird, pipes, and any other game elements. It will also
handle player input, collision detection, scorekeeping, and rendering the
game visuals on the screen.Upon collision, the game will transition to a game
over state, displaying the final score and providing options to restart or exit
the game.The game will utilize Pygame's functionalities to create a visually
appealing experience.Sprites: Image files will be used to represent the bird,
pipes, background, and any other visual elements.
7
The Requirement Specification:-
Technical Requirements
Additional Requirements
Explore difficulty levels with adjustable pipe speed and gap size.
Computer Requirement
Python SDK
8
Coding:
import random
import sys
import pygame
fps = 32
screen_width = 289
screen_height = 511
screen = pygame.display.set_mode((screen_width,screen_height))
ground_y = screen_height*0.8
game_images = {}
game_sounds = {}
def welcomeScreen():
player_x = int(screen_width/8)
message_y = int(screen_height*0.2)
title_y = int(screen_height*0.04)
base_x = 0
while True:
pygame.quit()
sys.exit()
9
return
else:
screen.blit(game_images['background'],(0,0))
screen.blit(game_images['message'],(message_x,message_y))
screen.blit(game_images['player'],(player_x,player_y))
screen.blit(game_images['base'],(base_x,ground_y))
screen.blit(game_images['title'],(title_x,title_y))
pygame.display.update()
fps_clock.tick(fps)
# Initialize Pygame
pygame.init()
pygame.display.set_caption('Flappy Bird')
fps_clock = pygame.time.Clock()
game_images['background'] = pygame.image.load(r"C:\Users\background.png").convert()
game_images['base'] = pygame.image.load(r"C:\Users\base.jpg").convert()
game_images['player'] = pygame.image.load(r"C:\Users\flappybirb.png").convert_alpha()
game_images['pipe'] = (
pygame.image.load(r"C:\Users \pipe.png").convert_alpha(),
pygame.image.load(r"C:\Userspipe2.png").convert_alpha()
game_images['message'] = pygame.image.load(r"C:\Users\message.png").convert_alpha()
pipe_height = game_images['pipe'][0].get_height()
player_x = int(screen_width/5)
10
player_y = int(screen_height/2)
base_x = 0
upper_pipes = [
lower_pipes = [
11
Conclusion and future work
Conclusion
This document has outlined the development of a Flappy Bird game using
Python and Pygame. The project provides a platform to learn core game
development concepts and create a playable and engaging game. By
implementing the functionalities described in the programming
requirements, a functional Flappy Bird game can be achieved.
Enhanced Visuals: Explore more complex animations for the bird and pipes,
potentially incorporating background variations.
Sound Effects and Music: Integrate sound effects for various game events
(flapping, collisions, scoring) and background music to enhance the user
experience.
High Score System: Implement a high score system that allows players to
track their best performances and compete with others.
12
Online Scoreboard: For a more social experience, explore integrating an
online scoreboard where players can compete globally.
By incorporating these future work possibilities, the Flappy Bird game can
be transformed into a more feature-rich and engaging experience. The
project can serve as a stepping stone for developers to delve deeper into
game development using Python and explore more complex game mechanics
and functionalities
13
References
1. StackOverflow.com, https://stackoverflow.co/,
Industry -Software Development, established in -2008.
2. Geeks for Geeks, https://www.geeksforgeeks.org, A-143, 9th Floor, Sovereign Corporate Tower,
Sector-136, Noida, Uttar Pradesh – 201305.
14