Download as pdf
Download as pdf
You are on page 1of 39
FLAPPY KINGFISHER GAM esc Prerercees oErS Reet er tbs BACHELOR OF SCIENCE (INFORMA TION TEC Sata ee 2018) ae NIN OY Salen a Bh Te CCne rt ra mb O SCO mr aA Rens see oos DEPARTMENT OF LNVORMATION Dicer Oy NAGENDAN KILANDWALA COLLEGE ae tee een co ey Bua Pres Caen a SSO DAs s FLAPPY KINGFISHER GAME A Project Report Submitted in partial fulfillment of the Requirements for the award of the Degree of BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY) By VEDANT PATIL 580 Under the esteemed guidance of Mrs. Vishakha Bagwe Assistant Professor DEPARTMENT OF INFORMATION TECHNOLOGY NAGINDAS KHANDWALA COLLEGE (Affiliated to University of Mumbai) (Autonomous) MUMBAI MAHARASHTRA YEAR 2020-21 Roll no: 580, 1. Name of the Student: Vedant Patil 2. Title of the Project: Flappy Kingfisher Game 3. Name of the Guide: Mrs. Vishakha Bagwe s ‘Teaching/Industry experience of the Guide: 13 years 5, Isthis your first submission? Yes waa Signature of the Student: Signature of the Guide: Date: . a Dat a Signature of the Coordinator: Date NAGINDAS KHANDWALA COLLEGE (Affiliated to University of Mumbai) (Autonomous) MUMBAI MAHARASHTRA 400064 DEPARTMENT OF INFORMATION TECHNOLOGY “This is to certify that the project titled, "FLAPPY KINGFISHER GAME", is bonafied work of VEDANT PATIL bearing Seat No: (580) submitted in partial fulfillment of the requirements for the award of degree of BACHELOR OF SCIENCE in INFORMATION TECHNOLOGY from University of Mumbai Coordinator Internal Guide External Examiner Date: “12 APR 2021 EXAMINED Abstract This document describes the pygame using python Flappy kingfisher game. Flappy Kingfisher game is mobile game that involves tapping the screen to navigate a bird through a gap between pairs of vertical pipes. When the bird passes through the gap, the score increments by one and the game ends when the bird hits the Pipe. Pygame is a library which is used to creating a game in python programming language. In pygame Game loop, Event, sprites and sound this four point are most important. ACKNOWLEDGEMENT I would like to express my gratitude and appreciation to all those who gave me the possibility to complete this project. A special thanks to my guide, parents, cousins, frends for providing me with my needs and their forever stimulating support. I take this opportunity to express my deep sense of gratitude towards my project guide Mr. Vishakha Bagwe for her help and letting me work as I wished without putting pressure on me. 1 also Thanks Mrs. Sindhu P.M. Head of Department of our section in college for ‘supporting me. Tam very thankful to Mrs. Ancy Jose, the principal of Nagindas Khandwala College for herkind co-operation in the completion of my project. Also a Large amount of Credit to Ms. Kimaya Patil For Helping us in Difficult times with the Project. T also thankful to our other staff of our department for facilitating me with the necessary requirements and support and co-operation. My project experience was satisfying fulfilling acknowledge filled lastly, 1 would like to thank my college Nagindas Khandwala college of ‘commerce, arts and science (autonomous) for providing me with proper ambience and supplying ie with the right amenities that has helped me complete this project on time and satisfyingly. DECLARATION I hereby declare that the project entitled, “Flappy Kingfisher Game” done at Nagindas Khandwala College, has not been in any case duplicated to submit to any other university for the award of any degree. To the best of my knowledge other than me, no one has submitted to any other university. ‘The project is done in partial fulfillment of the requirements for the award of degree of BACHELOR OF SCIENCE (INFORMATION TECHNOLOGY) to be submitted as final semester project as part of our curriculum. ee) (Vedant Patil) TABLE OF CONTENTS Chapter 1: Introduetion 1.1 Background. 1.2 Objective 1.3 Purpose, Scope, Applicability. 1.3.1 Purpose. 1.3.2 Scope. 13.3 Applicability 1.4 Achievements.. 1.5 Organisation of Report. Chapter 2: System Analysis 2.1 Problem Definition 2.2 Proposed System 2.3 Requirement Analysis. 2.4 Software Requirements. 2.4.1 Planning and scheduling . 2.41.2 Gantt Chart 2.5 Preliminary Product Description. 4 4 5 5 6 1 a 8 2.6 Conceptual Models. Chapter 3 : System Design 3.1 Basic module.. 3.2 Data Flow Diagrams / UML Diagrams... 3.2.1 Use case Diagram. 3.2.2 Activity Diagram Chapter 4: Implementation And Testing 4.1 Testing Approach. 4.1.1 Test Class. ‘Chapter 5 : Output Screen 5.1 Home Screen... 5.2 Start Game Page. 533 Sprite Page 5.4 Audio Page. 5.5 code, Chapter 6 : Conclusion and Future ‘Work Conclusion and Future Work . CHAPTER 1 INTRODUCTION My project name is “Flappy Kingfisher game”. I am making a pygame using a python programming language. Pygame is library which is used to creating a game is python programming language. Pygame is a set of python modules design for: writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python programming language. Pygame is free. Pygame is highly portable and runs on nearly every platform and operating system. Inpygame game loop, events, sprites and sound tis four oints are most important. While loop and infinite loop are helps to displays the sprites on screen again and again, they also help to play sound and accept the events from user. Flappy Kingfisher Game is Mobile game that involves tapping the sereen to navigate a bird through a gap between pairs of vertical pipes. When the bird passes through the gap, the score increments by one and the game ends when the bird hits the pipe then game is end, 1.1 Background ‘This game is a fun and intuitive mobile game player can tapping the screen to navigate a bird through a gap between pairs of vertical pipes. When the bird passes through the gap, the game ‘ends when the bird hits the pipe game as end. 1.2 Objective « Todevelop a game that was to breeze to use for the user. Flappy kingfisher game was designed as a 2D game with simplicity in mind, ‘¢ In game use touch sereen mode. + Pygame is a library which is used to ereating ® game in python programming language. In pygame (which is used to creating a game in python programming language) Game loop, Event, Sprites and Sound this Four points are going to be most important. While loop and infinite loop are helps to display the sprites on sereen again and again, they also help to play sound and accept the event from user. 1.3 Purpose, Scope, Applicability 13.1 Purpose To develop a game that was to designed as a 2D game with simplicity in mind. breeze to use for the user. Flappy kingfisher game was In game use touch screen mode. 13.2 Scope The flappy kingfisher game is a side-scroller where the player controls a bird, attempting to fly between columns of green pipes without hitting them. 13.3 Applicability ‘The application (Flappy kingfisher game) system will run on different devices like computer, mobile phones and tablets. A flappy kingfisher game in real life will ran on PC system with windows XP SP3 and upwards additionally it has Mac and Linux version. 1.4 Achievement “This project has helped me in learning more similar projects and how to make the project more creative, The more I was working on my project; I gained more knowledge and learned more interesting features and how to design my Game more creatively. This project has helped me to improve my programming, gaming skills and how to manage my time and consume time. Ithelped me to explore more similar projects and gain more information and knowledge about them. 1.5 Organization of report We will see the analysis of system, require pplication also we will take about some diagrams and ment specification, hardware and software specification, and the user interface of the ay how it helps to achieve our main goal. CHAPTER 2 SYSTEM ANALYSI 2.1 Problem Definition Our topic is Flappy Kingfisher game pygame using the python programming language. Fappy Kingfisher game is mobile game that involves tapping the Seren to navigate bird through a gap between pairs of vertical pipes. When the bird passes trough the ‘Bap, the score increments by one ‘and the game ends when the bird hits the Pipe. brary which is used to creating a game in python programming Pygame is a lil sound this four point are most language. In pygame Game loop, Event, sprites and important, 2.2 Proposed System Tn pygame game loop, event, sprites while loop four infinite loops are helps to display the sprites on screen again and again they also help € Play sound and accept the event from user. ‘When we do on loop then user can seems then he can playing games she Gok ke al things are really happening but reality the image is display on screen. 2.3 Requirement Analysis ‘The basic requirement of my project isa fun and intuitive game of play that any player can enjoy and enjoy. In this game the player can control the movement of the bird. In this game, the play can tap the screen to navigate a bird through a gap between pairs of vertical pipes. When the bird pass through the gap, the score increments by one and the game ends ‘When the bird hits pipe. ‘A game that was to breeze to use forthe user. In game player can use touch sereen mode, 2.4 Software Requirements Software Requirements: © Frontend Tool: vi © Pygame module Language: Python programming . © Compiler: IDE . ‘Operating system (OS) Visuat Studio Code IDE Visual studio code is free source-code editor made by Microsoft for windows, Linux, and isual studio macos, Visual studio code is # like debugging, task running, and vers! heeds for a quick code-build-debus °°" IDEs, such as visual Studio IDE ined cade editor with suppor for development operations ‘on control. It aims to provide just the tools a developer and leaves more complex workTOW to fuller featured Vs code runs on macOS, Linux, and windows. Pygame Module les Designed for writing games. Pygame adds functionality Pygame is a set of python modul you to create fully featured games and multimedia ontop of the excellent SDL library. This allows programs in the python Language. Pygame is highly portable runs on nearly every platform and operating system. icense, you can create open source, free, Pygame is free. Released under the GPL Lic freeware, shareware, and commercial games with it 2.4.1 Planning and Scheduling 2.4.1.2 Gantt Chart ering 01-06-2020 26-06-2020 = a Requrernene eh ie 30 28-06-2020 | 28-07-2020 Task3 Design 35 01-08-2020 (05-09-2020 Task Coding. 20 (01-10-2020 | 20-12-2020 ES os al 30 21-12-2020 | 20-01-2021 Pereses| aa 21-01-2021 | 15-02-2021 Gantt Chart 01-06-20 21.07.21 fo 21.07-20 09-08-20 29-10-20 1812-20 060221 78-0324 ~ ~ # Task 3 “ a Task 6 2.5 a ne Preliminary Product Description a, Toit going to use visual studi? ode DE. Pyzame isa library that use to creates game in python programming. It has four important things © Game loop * Event «© Sprites * Sound Flappy Kingfisher game #6 n to navigate bind through a gap between pairs ne game ends involves tapping the seree at i through the gap, «, When the bird passe the bird hits the Pipe. mobile game th of vertical pipe when ene to use for the User the score i ‘ote inerements by one and! .e with simplicity in mind. hat was t0 PF «To develop a game! jened as a 2D gam In game use touch screen mode. 2.6 Conceptual Models CHAPTER 3 SYSTEM DESIGN 3.1 Basic module 3 Sj 2 Data Flow Diagram/UML Diagram 3.2.1 Use case Diagram Calculate points (increment) 3.2.2 Activity Diagram CHAPTER 4 IMPLIMENTATION AND TESTING 4.1 Testing Approach 4.1.1 Test Cases Playing Game Test Cases Testa] Description Txpected Result i Result | Remarks V New provider try t Should return a massage rae start game. start playing 2 Invalid Start. “Tap to screen Do not start ‘Success 3 | Invalid play Fry to play again. Play Correctly ‘Suck ‘Start a new game. Verify player beac Failure CHAPTER 5 OUTPUT SCREEN Home Screen :- Start Game Page :- Sprites Page :- Code:- import random # For generating random numbers import sys # We will use sys.exit to exit the program import pygame from pygame.locals import * # Basic pygame imports # Global Variables for the game FPS = 32 SCREENWIDTH = 289 SCREENHEIGHT = 511 SCREEN = pygame.display.set_mode((SCREENWIDTH, SCREENHEIGHT)) GROUNDY = SCREENHEIGHT * 0.8 GAME_SPRITES = {} GAME_SOUNDS = (3 PLAYER = 'gallery/sprites/bird.png’ BACKGROUND = ‘gallery/sprites/background.png’ PIPE = ‘gallery/sprites/pipe-png’ def welcomeScreen(: Shows welcome images on the screen playerx = int(SCREENWIDTH/5) playery = int((SCREENHEIGHT - GAME_SPRITES[player'].get_height())/2) messagex = int((SCREENWIDTH - GAME_SPRITES['message’] .get_width())/2) messagey = int(SCREENHEIGHT*0.13) basex = 0 while True: for event in pygame.event.get(): # if user clicks on cross button, close the game if event.type = QUIT or (event.type=KEYDOWN and event.key == K_ESCAPE): pygame.quit) sys.exit() # If the user presses space OF UP key, start the game for them. elif. ‘event.type=-KEYDOWN and (event.key=K_SPACE or event.key = K_UP): return else: SCREEN.blit(GAME_SPRITES[background'], (0, 0)) SCREEN. blit(GAME_SPRITES[player'], (playerx, playery)) SCREEN. blit(GAME_SPRITES['message’], (messagex,messagey )) SCREEN. blit(GAME_SPRITES['base'], (basex, GROUNDY)) pygame.display.update() FPSCLOCK.tick(FPS) def mainGame(Q): score = 0 playerx = int(SCREENWIDTH/S) playery = int(SCREENWIDTH/2) basex = 0 # Create 2 pipes for blitting on the screen newPipel = getRandomPipe() newPipe2 = getRandomPipe() # my List of upper pipes upperPipes = [ {'x': SCREENWIDTH+200, ‘ynewPipel[0]['y'T} (xt: SCREENWIDTH+200+(SCREENWIDTH?), ‘ynewPipe2(01[y'1} ] # my List of lower pipes lowerPipes = [ {x': SCREENWIDTH+200, 'y':newPipel[1[y]}> {x's SCREENWIDTH+200+(SCREENWIDTH/2), ‘yrnewPipe2[1]' 3 ] pipeVelX = -4 playerVelY = -9 playerMaxVelY = 10 playerMinVelY = -8 playerAccY = 1 playerFlapAccv = -8 # velocity while flapping playerFlapped = False # It is true only when the bird is flapping while True: for event in pygame.event.get(): if event.type = QUIT or (event. event.key == K_ESCAPE): pygame.quit0 type = KEYDOWN and sys.exit() if event.type = KEYDOWN and (event.key = K_SPACE or event.key = K_UP): if playery > 0: playerVelY = playerFlapAccy playerFlapped = True GAME_SOUNDS['wing'].play) crashTest = isCollide(playerx, playery, upperPipes, lowerPipes) # This function will return true if the player is crashed if crashTest: return #check for score playerMidPos = playerx + GAME_SPRITES[player'].get_width(/2 for pipe in upperPipes: pipeMidPos = pipe['x'] + GAME. SPRITES[pipe'TI0].-get_width0/2 if pipeMidPos<= playerMidPos < pipeMidPos +4: score +=1 print(f"Your score is {score}") GAME_SOUNDS['point'|.play0 if playerVelY GROUNDY - 25 or playery<0: GAME_SOUNDS[tit') play return True for pipe in upperPipes: pipeHeight = GAME. SPRITES[ pipe'I[0]-get_height0 if(playery < pipeHeight + pipel'y and abs(playerx - pipel'x’)) < GAME. SPRITES['pipe']01-2¢t_widthO?: GAME_SOUNDSThit'}play0 return True for pipe in lowerPipes: ; ; if (playery + GAME, SPRITES(player'}-get_heighO > pipe[y') and abs(playerx - pipelx‘D < GAME. SPRITEST pipe 0} get_wisthO: GAME_SOUNDSTRit] play0 return True return False def getRandomPi ipeQ: Generate positions of two pipes(one bottom straight and one top rotated ) for blitting on the screen pipeHeight = GAME_SPRITES[pipe'l[0]-get_heightO offset = SCREENHEIGHT/3 y2= offset + random.randrange(0, int(SCREENHEIGHT - GAME_SPRITES['base'] .get_height() - 1.2 *offset)) pipeX = SCREENWIDTH + 10 yl= pipeHeight - y2 + offset pipe=[ (x': pipeX 'y': -Y 1}, dupper Pipe {x pipeX, 'y"? y2} #lower Pipe ] return pipe if__name__—= *_main_": # This will be the main point from where our game will start pygame.init() # Initialize all pygame’s modules FPSCLOCK = pygame.time.Clock(Q) pygame.display.set_caption(Flappy Kingfisher By Vedant’) GAME_SPRITES[‘numbers'] =( pygame.image.load(gallery/sprites/0.png).convert_ alpha, pygame.image.load(‘gallery/sprites/ | .png’).convert_alpha(), load(‘gallery/sprites/2.png’).convert_alpha(), png’).convert_alpha(), png’).convert_alpha(), pygame.image. pygame.image.load(‘gallery/sprites/3. pygame.image-load(gallery/sprites4, ayeame image load gallery/psites/spne).conver- Pha aygame image 1a aler/sprtelépne)conen. A game mage 0 aloe”) seve vga meg na lr oes) cone! rrpeme ieee gaeepes enemas PN ) message’) GAME_SPRITEST" gallery/sprites/mes convert_alpha() . ad(' sage-png)). =pygame.image-lo: GAME_SPRITES['base’] =pygame.image-load('gallery/sprites/base-png’).convert alpha() GAME_SPRITES[ pipe] ~(pygame transform rotate(pygame.image-load( PIPE).convert_alpha(), 180), il ; pygame.image.load(PIPE).convert_alphaQ) ) # Game sounds GAME_SOUNDS[‘die']= pygame.mixer Sound gallery/audio/éie-wav’) GAME_SOUNDS[hit] = pyeame mixer Sound( galery/andiofhitwvav) GAME_SOUNDS[point’] = pygame mixer Sound galeryandiospoiatvav) GAME_SOUNDS['swoosh'] = ayeame,mixer Sound gallryausiafswonsh va) GAME_SOUNDS[wing!] 7 oyeame mixer SoundC gallery/auionwine wa) GAME_SPRITES[backeround] = ssa ining SoosBACEGROND IT GAME_SPRITEST'player’] = pygame.imageload(PLAYER).convert_alpha() while True: welcomeScreen() # Shows welcome screen to the user until he presses a button mainGame() # This is the main game function CHAPTER 6 FUTURE WORK & CONCLUSION Future Work :- {As per the Player Requirement our Project is Designed. We can do extra Additional to our project. We will also try to Modification, Update, Delete or any other things in our project. Conclusion :- ‘The Working on the Project was a very good Experience. | had understand the importance of Planning & Designing a part ofthe Software Development. But I's a very Tuffto ‘Complete the project as a single person. Web Link :- www.google.com www.voutube.e www .wikipedia.com ma pygameorg, CHAPTER 7 REFERENCE

You might also like