0% found this document useful (0 votes)
7 views12 pages

SynopsisOfProject by Ekta

Uploaded by

ekatamgs.10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

SynopsisOfProject by Ekta

Uploaded by

ekatamgs.10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

A

MINI PROJECT
ON
FLAPPY BIRD
Submitted
By
KM. EKATA
(Bachelor of Technology)
4th sem.
Under the guidance of
Mr. Ved Prakash
Assistant Professor
(Department of computer science)

Department of computer Science


Faculty of technology
Sambhunath institute of engineering and technology, Allahabad
Session – 2021-2022
CANDIDATES’S DECLARATION

I hereby declare that the mini project work being presented in


this report entitled “FLAPPY BIRD” submitted in the
department of Computer science Shambhunath Institute of
Engineering & Technology Allahabad is the work carried out by
me under the guidance of Mr. Ved Prakash, assistant
professor, Department of Computer Science Shambhunath
Institute of Engineering & Technology Allahabad.

Date --/--/--- KM. EKATA


(B tech 4th SEM)
CERTIFICATE

This is to certify that this report represents the original work


done by KM. EKATA during this project submission as a partial
fulfillment of the requirement for the system Design project of
Bachelor of Technology 4th Semester, of the Shambhunath
Institute Engineering &Technology.

Date --/--/--- KM. EKATA


B tech 4th SEM
ACKNOWLEDGMENT

I would like to express my special thanks of gratitude to my


teacher Mr. Ved Prakash who gave me the golden opportunity
to this wonderful Project on the topic FLAPPY BIRD, which is
also helped me in doing a lot of Research and I came to know
about so many new thongs I am really thankful to them.
in finalizing this project with-in the limited time frame.
Table of contents
 Title
 Introduction
 Objective
 Language and software tool used
 Required Modules
 Library Installation
 Snapshot
 Resources and Source code
 Conclusion

1. Title of the project:


Flappy Bird

2. Introduction:
Flappy bird was originally released as mobile game where you
tap the screen to make the bird fly. If the bird hits the pipes or
the edges of the screen, the game ends and the player need to
restart.

3. Objective:
we have made a computer version of the game where the bird
will be controlled using the the space bar.

4. HARDWARE REQUIRMENT
 OS- Windows
 Hard Disk-500GB
 RAM-2GB
 Intel core i3 5th Gen (Other- Core i4, core i5 etc).

5. SOFTWARE REQUIREMENTS: -
 Visual Studio Text Editor.
 Python Software PYTHON 3.10.0 (version).
 Windows Operating system (windows 10, windows 7
etc.)

6. Required Modules:
 random: For generating random numbers
 sys: We will use sys to exit the program
 Pygame: To build 2D games in Python

7. Library Installation:
we need to install the necessary required module or library. By
default, random and sys come preinstalled in python. we need
to install Pygame. For that, you need to write the following
command in your terminal or command prompt.

pip install Pygame


8. Snapchat:
9. Resources and Source code:

import pygame
import sys
import random

pygame.init()

width = 1270
heigth = 720
screen = pygame.display.set_mode((width,heigth))
clock = pygame.time.Clock()
fps = 60

# images
background = pygame.image.load("images/background.png").convert_alpha()
bird = pygame.image.load("images/bird.png").convert_alpha()
pipe = pygame.image.load("images/pipe.png").convert_alpha()
rotatedPipe =
pygame.image.load("images/rotated_pipe.png").convert_alpha()

# sounds
point = pygame.mixer.Sound("sounds/sfx_point.wav")
hit = pygame.mixer.Sound("sounds/sfx_hit.wav")

# Game Caption
pygame.display.set_caption("Flappy Bird by Ekat")

class Game:
def __init__(self):
self.gameOn = True
self.birdX = 100
self.birdY = 100
self.pipesX = [width, width+200, width+400, width+600, width+800,
width+1000, width+1200]
self.lowerPipeY =
[self.randomPipe(),self.randomPipe(),self.randomPipe(),self.randomPipe(
),
self.randomPipe(),self.randomPipe(),self.randomPipe()]
self.upperPipeY =
[self.randomRotatedPipe(),self.randomRotatedPipe(),self.randomRotatedPi
pe(),self.randomRotatedPipe(),
self.randomRotatedPipe(),self.randomRotatedPipe(),self.randomRotatedPip
e()]
self.gravity = 0
self.pipeVel = 0
self.flap = 0
self.score = 0
self.rotateAngle = 0
self.isGameOver = False
self.playSound = True

def movingPipe(self):
for i in range(0,7):
self.pipesX[i] += -self.pipeVel

for i in range(0,7):
if(self.pipesX[i] < -50):
self.pipesX[i] = width + 100
self.lowerPipeY[i] = self.randomPipe()
self.upperPipeY[i] = self.randomRotatedPipe()

def randomPipe(self):
return random.randrange(int(heigth/2)+50, heigth-200)

def randomRotatedPipe(self):
return random.randrange(-int(heigth/2)+100, -100)

def flapping(self):
self.birdY += self.gravity
if(self.isGameOver == False):
self.flap -= 1
self.birdY -= self.flap

def isCollide(self):
for i in range(0,7):
if(self.birdX >= self.pipesX[i] and self.birdX <=
(self.pipesX[i]+pipe.get_width())
and ((self.birdY+bird.get_height()-15) >= self.lowerPipeY[i] or
(self.birdY) <= self.upperPipeY[i]+rotatedPipe.get_height()-15)):
return True

elif(self.birdX == self.pipesX[i] and (self.birdY <= self.lowerPipeY[i]


and self.birdY >= self.upperPipeY[i])):
if(self.isGameOver == False):
self.score += 1
pygame.mixer.Sound.play(point)

if(self.birdY <= 0):


return True

elif(self.birdY+bird.get_height() >= heigth):


self.gravity = 0
return True

return False

def gameOver(self):
if(self.isCollide()):
self.isGameOver = True
self.screenText("Game Over!", (255,255,255), 450, 300, 84, "Fixedsys",
bold=True)
self.screenText("Press Enter To Play Again", (255,255,255), 400, 600,
48, "Fixedsys", bold=True)
self.pipeVel = 0
self.flap = 0
self.rotateAngle = -90
if(self.playSound):
pygame.mixer.Sound.play(hit)
self.playSound =False

def screenText(self, text, color, x,y, size, style, bold=False):


font = pygame.font.SysFont(style, size, bold=bold)
screen_text = font.render(text, True, color)
screen.blit(screen_text, (x,y))

def mainGame(self):
while self.gameOn:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()

if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
if(self.isGameOver == False):
self.pipeVel = 5
self.gravity = 10
self.flap = 20
self.rotateAngle = 15

if event.key == pygame.K_RETURN:
newGame = Game()
newGame.mainGame()

if event.type == pygame.KEYUP:
if event.key == pygame.K_SPACE:
self.rotateAngle = 0

# blitting images
screen.blit(background, (0,0))

for i in range(0,7):
# lower Pipe
screen.blit(pipe, (self.pipesX[i], self.lowerPipeY[i]))
# upper pipe
screen.blit(rotatedPipe, (self.pipesX[i], self.upperPipeY[i]))

screen.blit(pygame.transform.rotozoom(bird, self.rotateAngle, 1),


(self.birdX, self.birdY))

# moving pipe
self.movingPipe()
# flapping
self.flapping()
# game over
self.gameOver()
# displaying score
self.screenText(str(self.score), (255,255,255), 600, 50, 68,
"Fixedsys", bold=True)

pygame.display.update()
clock.tick(fps)

falppyBird = Game()
falppyBird.mainGame()

10.Conclusion:
The design and development of this game will significantly
enhance the communication way. This application is providing
entertainment.
This game is developed by using python language.

You might also like