Flappy Bird Game Using Python
PROJECT REPORT
                      Submitted by
                  PANKAJ PAL
               3rd YR CSE(B.Tech)/2019-2022
                   Under the guidance of
                Poonam Yadav
          in partial fulfilment of the requirements
               for the award of the Degree of
        BACHELOR OF TECHNICAL
                             Of
   DEPARTMENT OF COMPUTER SCIENCE
Accurate Institute of Management and Technology
            GAUTAM BUDDH NAGAR-201306
                         JAN 2021
                      Department of CSE & AIMT
                               CERTIFICATE
This is to certify that the report entitled “FLAPPY BIRD GAME USING PYTHON” by
PANKAJ PAL 1902250109001 in partial filfulment of the requirement for the
award of the Degree of Bachlor of Technology is a bonafide record of the
project work done by PANKAJ PAL of CSE & AIMT.
Name of Guide
MRS. Poonam MAM
                                  ACKNOWLEDGEMENT
Through this acknowledgement I express my sincere gratitude towards all those people who helped
me in this project, which has been a learning experience.
This space wouldn’t be enough to extend my warn gratitude towards my project guide Poonam Yadav
for his effort in coordinating with my work and guiding in the right direction.
I escalate a heartfelt regard to our Institute Director …….                   for giving me the
essential hand in concluding this work.
It would be injustice to proceed without acknowledgement those vital support I received from my
beloved classmate and friends, without whom I would have been half done.
I also use this space to offer my sincere love to my parent and all other who had been there, helping
                                      me walk through this work.
                                                                                 PANKAJ PAL
                                  DECLARATION
I undersigned, hereby declare that the project FLAPPY BIRD GAME submitted in partial
Fulfilment for the award of Degree of Bachlor of Technology of A P J Abdul
Kalam Technological University is a bonafide record of work done by me under the
guidance
Of Poonam Yadav ,Department of CSE(Computer Science Engineer). This report has not
previously formed the basis for
the award of any degree similar title of any University.
15/01/2021                                                  Signature
          Index
Sr. No.              Topic
  Iii              Certificate
  Iv
             Acknowledgement
  1.1             Introduction
  1.2               Overview
  1.3
            SCOPE OF FLAPPY BIRD
  1.4
             TECHNOLOGY USED
   2        History of Flappy Bird
  2.1       Software Requirement
  2.2
                   GAME PLAY
  2.3
                  DEVELOPMENT
  3                  Python
  3.1               Overview
  3.2         History of Python
  3.3        DECISION MAKING
   4            SNAPSHOT
  4.1              Background
  4.2                 Pipe
         4.3                                                                 Base
         4.4                                                                  Bird
         4.5                                                              Message
         5                                                   FURTHER IMPROVEMENT
         6                                                           BIBLIOGRAPHY
                                                                          Website
         6.1
                                               INTRODUCTION
                                                   1.1 Overview
Flappy Bird is a Pc Game. The game was released in may 2013 but received a sudden rise in popularity in early 2014.Flappy Bird
received poor reviews from some critics, who criticized its level of difficult, alleged plagiarism in graphics and game
mechanics, while other reviewers found it addictive. He claims that he felt guilt over what he considered to be its additive
nature and overuse. Bay Tek Games also released a licensed coin operated Flappy Bird are Arcade Game.
                                       1.2 SCOPE OF FLAPPY BIRD
The game is a side-Scroller where the player control a bird, attempting to fly between rows of green pipes without coming into
contact them. If the player touches the pipe, it ends the game. The bird briefly flaps upward each time the player tabs the
screen; if the screen is not tapped, the bird falls due to gravity.
         Preparation Tools
         Personalized Coaching
         College related to Updated
                                          1.3 TECHNOLOGY USED
Technology we have used in this project.
          Python
                                        2 History of Flappy Bird
Flappy Bird game is developed by Vietnamese video game artist and programmer Dong Nguyen under his game development
company dotGears.
         Nguyen created the game over the period of several days, using a bird protagonist that he had designed for a
cancelled game in 2012.
                                        2.1 Software Requirement
   Memory:512MB
   Graphics Card: NVIDIA GeForce7200GS
   A Flappy Bird in File :100MB
   OS: Window XP, 7 8,10
                                                  2.2 GAME PLAY
Flappy Bird is a arcade-style game which the player controls the bird faby, Which moves persistently to the right. The player is
tasked with navigating Faby through pairs of pipes that have equally sized gaps placed at random height. Fabs automatically
descends and only ascends when the player tabs the space button on the keyboard. Each successful pass through a pair of
pipes awards the player one point. Colliding with a pipe or the ground ends the gameplay. During the game over screen, the
player is awarded a bronze medal if they reaches ten or more point, a silver medal from twenty points. A gold medal from thirty
points, and a platinum medal from forty point .
                                                  2.3 DEVELOPMENT
He discovered video games by playing super Mario bros as a child, and began coding his own at age 16 act 19, while studying
programming at a local university, he won an internship. At the one of the video game companies in Vietnam. While using the
PC, he found that its most popular games such as Angry Bird were too complicated, and wanted to make a simpler game for
people who are always on the move.
          The gameplay was inspired by the act of bouncing a ping pong ball against a paddle for as possible. Initially the game
was significantly easier than it became in the final version however said he found this version to be boring and subsequently
tightened up the difficult.
          It’s a games as “heavily influenced by retro pixelated games in its golden age. Everything is pure, extremely hard and
incredibly fun to play”.
                                                         3 PYTHON
                                                       3.1 Overview
Python is a high-level, easy to learn, interpreter, interactive and object-oriented scripting language. Python is a designed to be
highly readable. It uses English keywords frequently where as other language use punctuation, and it has fewer syntactical
construction than other languages.
                                                3.2 History of Python
Python was developed by GUIDO VAN ROSSUM in the late eighties and early nineties at the National Research Institute for
Mathematics and Computer Science in the Netherlands.
          Python is derived from many other language, including ABC, module-3, C,C++ ,Anglo-68, SmallTalk, and Unix shell and
other scripting language.
                                              3.3 DECISION MAKING
Decision in a program are used when the program has condition choices to execute code block.. let’s taken an example of
traffic light, where different color of lights lit up at different situations based on the condition of the road or any specific rule.
 Statement              Description
 If Statement          It consists of a Boolean expression which result is either TRUE or FALSE followed by one or more statement
 If else Statement       It also contain a Boolean Expression. The if statement is followed by an optional else statement & if the
                        expression result in FALSE, then else statement gets executed. It is also called alternative execution in which
                        there are two possibilities of the condition determine in which any one of them will get executed.
 Nested                We can implement if statement and or if-else statement inside another if or if –else statement. Here more
                       than one if condition are applied & there can be more than one if within elif.
         It is the prediction of conditions that occur while executing a program to specify action. Multiple expressions get
evaluated with an outcome of either TRUE or FALSE. These are logical decisions, and Python also provides decision-making
statement that to make decision within a program for an application based on the user requirement.
                                                3.3.1 If Statement
                                                        Flow Chart
                                                         START
                                                       EXPRESSI
                                                         ON
                                                         TRUE
                                                    STATEMENT                                                         FALSE
                                                         STOP
                                             3.2 LOOPS
                                                                                                    CONDITION CODE
                                                                                  IF CONDITION IS TRUE
                                        CONDITION
                                                   If condition is False
Loops          Description
For Loops      Executes a sequence of statement multiple times and abbreviates the code that manages the loop
               variable
While Loops    Repeats a statement or group of statement while a given condition is TRUE. It test the condition
               before executing the loop body
Nested Loops   You can one or more loop inside any another while, for or do.. while loop.
                             3.2.1 LOOP CONTRTOL STATEMENT
Loop control statement change execution from its normal sequence. When execution leaves a scope, all automatic
objects that were created in that scope are destroyed.
 LOOP CONTROL Description
 STATEMENT
 Break Statement          Terminates the loop statement and transfer execution immediately following the
                          loop.
 Continue Statement       Causes the loop to skip the remainder of its body and immediately retest its
                          condition prior to reiterating.
 Pass Statement           The pass statement in python is used when a statement is required syntactically
                          but you do not want any command or code to execute.
                                    3.3 PYTHON DATA TYPE
                                               3.3.1 Number
Number is data type of the python. When they are store in numeric value in python. They are immutable data types,
means that changing the value of a number data type result in a newly allocated object.
        There are different numerical type:-
 Int(Signed Integer)- They are often called just integer or ints, are positive or negative whole
    number with no decimal point.
 Long(Long Integer)- Also called longs, they are integer of unlimited size, written like integers and
    followed by an uppercase or lowercase L.
 Float(Floating Point Real Value)- Also called floats, they represent real number and are
    written with a decimal point dividing the integers and fractional parts. Floats may also be in scientific notation,
    with E or e indicating the power.
   Complex(Complex Number)- Are of the form a + bJ, where a and b are floats and J (or j)
    represents the square root of -1 (which is an imaginary number). The real part of the number is a, and the
    imaginary part is b. Complex number are not used much in python programming.
     Int             Long                                   Float                  Complex
     10              51924361L                              0.0                    3.14
     100             -0x19323L                              15.20                  45.j
     -786            0122L                                  -21.9                  9.322e-36j
     080             0xDEFABCECBDAECBFBAFL                  32.3+e18               .876j
     -0490           535633629843L                          -90.                   -.6545+0J
     -0x260          -052318172735L                         -32.54e100             3e+26J
     0x69            -4721885298529L                        70.2-E12               4.53e-7j
                                                 3.3.2 String
String are amongst the most popular types in python. We can create
them simply by enclosing characters in quotes. Python treats single quotes the same as double quotes. Creating strings
is as simple as assigning a value to a variable.
3.3.2.1 Accessing Values in Strings
Python does not support a character type; these are treated as strings of length one, thus also considered a substring.
                                       3.3.2.2Updating Strings
You can "update" an existing string by (re)assigning a variable to another string. The new value can be related to its
previous value or to a completely different string altogether.
                                3.3.2.3 String Special Operators
  Operator                                          Description                                                     Example
 +                Concatenation - Adds values on either side of the operator                            a + b will give HelloPython
 *                Repetition - Creates new strings, concatenating multiple copies of the same           a*2 will give -HelloHello
                  string
 []               Slice - Gives the character from the given index                                      a[1] will give e
 [:]              Range Slice - Gives the characters from the given range                               a[1:4] will give ell
 in               Membership - Returns true if a character exists in the given string                   H in a will give 1
not in          Membership - Returns true if a character does not exist in the given string           M not in a will give 1
r/R             Raw String - Suppresses actual meaning of Escape characters. The syntax for           print r'\n' prints \n and print
                raw strings is exactly the same as for normal strings with the exception of the       R'\n'prints \n
                raw string operator, the letter "r," which precedes the quotation marks. The "r"
                can be lowercase (r) or uppercase (R) and must be placed immediately
                preceding the first quote mark.
%               Format - Performs String formatting                                                   See at next section
                                3.3.2.4Built-in String Methods
    Sr. No.                                         Methods with Description
1             capitalize()
              Capitalizes first letter of string
2             center(width, fillchar)
              Returns a space-padded string with the original string centered to a total of width columns.
3             count(str, beg= 0,end=len(string))
              Counts how many times str occurs in string or in a substring of string if starting index beg and ending index
              end are given.
4             decode(encoding='UTF-8',errors='strict')
              Decodes the string using the codec registered for encoding. encoding defaults to the default string
              encoding.
5             encode(encoding='UTF-8',errors='strict')
     Returns encoded string version of string; on error, default is to raise a ValueError unless errors is given
     with 'ignore' or 'replace'.
6    endswith(suffix, beg=0, end=len(string))
     Determines if string or a substring of string (if starting index beg and ending index end are given) ends
     with suffix; returns true if so and false otherwise.
7    expandtabs(tabsize=8)
     Expands tabs in string to multiple spaces; defaults to 8 spaces per tab if tabsize not provided.
8    find(str, beg=0 end=len(string))
     Determine if str occurs in string or in a substring of string if starting index beg and ending index end are
     given returns index if found and -1 otherwise.
9    index(str, beg=0, end=len(string))
     Same as find(), but raises an exception if str not found.
10   isalnum()
     Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.
11   isalpha()
     Returns true if string has at least 1 character and all characters are alphabetic and false otherwise.
12   isdigit()
     Returns true if string contains only digits and false otherwise.
13   islower()
     Returns true if string has at least 1 cased character and all cased characters are in lowercase and false
     otherwise.
14   isnumeric()
     Returns true if a unicode string contains only numeric characters and false otherwise.
15   isspace()
     Returns true if string contains only whitespace characters and false otherwise.
16   istitle()
     Returns true if string is properly "titlecased" and false otherwise.
17   isupper()
     Returns true if string has at least one cased character and all cased characters are in uppercase and false
     otherwise.
18   join(seq)
     Merges (concatenates) the string representations of elements in sequence seq into a string, with separator
     string.
19   len(string)
     Returns the length of the string
20   ljust(width[, fillchar])
     Returns a space-padded string with the original string left-justified to a total of width columns.
21   lower()
     Converts all uppercase letters in string to lowercase.
22   lstrip()
     Removes all leading whitespace in string.
23   maketrans()
     Returns a translation table to be used in translate function.
24   max(str)
     Returns the max alphabetical character from the string str.
25   min(str)
     Returns the min alphabetical character from the string str.
26   replace(old, new [, max])
     Replaces all occurrences of old in string with new or at most max occurrences if max given.
27   rfind(str, beg=0,end=len(string))
     Same as find(), but search backwards in string.
28   rindex( str, beg=0, end=len(string))
     Same as index(), but search backwards in string.
29   rjust(width,[, fillchar])
     Returns a space-padded string with the original string right-justified to a total of width columns.
30   rstrip()
     Removes all trailing whitespace of string.
31   split(str="", num=string.count(str))
     Splits string according to delimiter str (space if not provided) and returns list of substrings; split into at
     most num substrings if given.
32   splitlines( num=string.count('\n'))
     Splits string at all (or num) NEWLINEs and returns a list of each line with NEWLINEs removed.
33   startswith(str, beg=0,end=len(string))
     Determines if string or a substring of string (if starting index beg and ending index end are given) starts
     with substring str; returns true if so and false otherwise.
34   strip([chars])
     Performs both lstrip() and rstrip() on string.
35   swapcase()
     Inverts case for all letters in string.
36   title()
     Returns "titlecased" version of string, that is, all words begin with uppercase and the rest are lowercase.
37   translate(table, deletechars="")
     Translates string according to translation table str(256 chars), removing those in the del string.
 38             upper()
                 Converts lowercase letters in string to uppercase.
 39             zfill (width)
                 Returns original string leftpadded with zeros to a total of width characters; intended for numbers, zfill()
                 retains any sign given (less one zero).
 40             isdecimal()
                 Returns true if a unicode string contains only decimal characters and false otherwise.
                                             3.3.3 Python List
The list is a most versatile datatype available in Python which can be written as a list of comma-separated values
(items) between square brackets. Important thing about a list is that items in a list need not be of the same type .
                                    3.3.3.1Basic List Operations
Lists respond to the + and * operators much like strings; they mean concatenation and repetition here too, except that
the result is a new list, not a string.
        Python Expression                                    Results                             Description
               len([1, 2, 3])                                      3                                 Length
            [1, 2, 3] + [4, 5, 6]                        [1, 2, 3, 4, 5, 6]                      Concatenation
                 ['Hi!'] * 4                          ['Hi!', 'Hi!', 'Hi!', 'Hi!']                 Repetition
               3 in [1, 2, 3]                                   True                              Membership
       for x in [1, 2, 3]: print x,                        123                   Iteration
                                      3.3.3.2Built-in List Functions & Methods
Sr. No.                                            Function with Description
1                 cmp(list1, list2)
                  Compares elements of both lists.
2                 len(list)
                  Gives the total length of the list.
3                 max(list)
                  Returns item from the list with max value.
4                 min(list)
                  Returns item from the list with min value.
5                 list(seq)
                  Converts a tuple into list.
    Sr. No.                                        Methods with Description
1                  list.append(obj)
                    Appends object obj to list
 2                  list.count(obj)
                    Returns count of how many times obj occurs in list
 3                  list.extend(seq)
                    Appends the contents of seq to list
 4                  list.index(obj)
                    Returns the lowest index in list that obj appears
 5                  list.insert(index, obj)
                    Inserts object obj into list at offset index
 6                  list.pop(obj=list[-1])
                    Removes and returns last object or obj from list
 7                  list.remove(obj)
                    Removes object obj from list
 8                  list.reverse()
                    Reverses objects of list in place
 9                  list.sort([func])
                    Sorts objects of list, use compare func if given
                                                   3.3.4 TUPLE
A tuple is a collection of objects which ordered and immutable. Tuples are sequences, just like lists. The differences
between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists
use square brackets.
                                      3.3.4.1 Basic Tuples Operations
Tuples respond to the + and * operators much like strings; they mean concatenation and repetition here too, except
that the result is a new tuple, not a string.
           Python Expression                                     Results                       Description
                      len((1, 2, 3))                                      3                         Length
                  (1, 2, 3) + (4, 5, 6)                         (1, 2, 3, 4, 5, 6)               Concatenation
                       ('Hi!',) * 4                          ('Hi!', 'Hi!', 'Hi!', 'Hi!')          Repetition
                      3 in (1, 2, 3)                                   True                       Membership
               for x in (1, 2, 3): print x,                            123                          Iteration
                                       3.3.4.2Built-in Tuple Functions
  Sr. No.                                            Function with Description
1                 cmp(tuple1, tuple2)
                  Compares elements of both tuples.
2                 len(tuple)
                  Gives the total length of the tuple.
3                 max(tuple)
                  Returns item from the tuple with max value.
 4                min(tuple)
                  Returns item from the tuple with min value.
 5                tuple(seq)
                  Converts a list into tuple.
                                                3.3.5 Dictionary
Each key is separated from its value by a colon (:), the items are separated by commas, and the whole thing is enclosed
in curly braces. An empty dictionary without any items is written with just two curly braces, like this: {}.
Keys are unique within a dictionary while values may not be. The values of a dictionary can be of any type, but the
keys must be of an immutable data type such as strings, numbers, or tuples.
                    3.3.6 Built-in Dictionary Functions & Methods
  Sr. No.                                           Function with Description
                 cmp(dict1, dict2)
                 Compares elements of both dict.
 2               len(dict)
                 Gives the total length of the dictionary. This would be equal to the number of items in the dictionary.
3   str(dict)
    Produces a printable string representation of a dictionary
4   type(variable)
    Returns the type of the passed variable. If passed variable is dictionary, then it would return a dictionary
    type.
                                 4 SNAPSHOT
                                4.1 Background
4.2 Pipe
4.3 Base
4.4 Bird
                                          4.5 Message
                           5 FURTHER IMPROVEMENT
   This game can be made dynamic by using level, game over etc.
   The game is control a key press description as show in this game.
   This game can be further enhanced by adding more future.
                      6 BIBLIOGRAPHY
                        6.1 Website
 http://freshlogoz.blogspot.com
 http://tutorialspoint.com
 http://google.com