You are on page 1of 30

St.

Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
naly
earEi
ght
hSemest
erRepor
t
Cov
erPage

St
.Thomas’
Col
legeofEngi
neer
ingandTechnol
ogy

Fl
appyBi
rdGame

Pr
epar
edby

Sr
iyansDaga 171220110117

MdAbdulRahman 171220110088

MdTousi
fNoor 171220110092

Undert
hegui
danceof

Ni
l
anjanKarmakarand
AmitSi
romoni

Ment
or’
sDesi
gnat
ion,
Depar
tment
Pr
ojectRepor
t
Submi
tt
edi
nthepar
ti
alf
ulf
il
lmentofther
equi
rementf
ort
hedegr
eeofB.
Techi
n
Inf
ormati
onTechnol
ogy

Depar
tmentofI
nfor
mat
ionTechnol
ogy
Af
fi
li
atedt
o

Maul
anaAbul
Kal
am Az
adUni
ver
sit
yofTechnol
ogy,
Wes
tBengal

Jul
y2021

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 1
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
naly
earEi
ght
hSemest
erRepor
t

St
.Thomas’
Col
l
egeofEngi
neer
ingandTechnol
ogy

Thisistocerti
fythatthewor ki
nprepar
ingt
heprojectent
it
led Fl
appyBirdGame
hasbeencar r
iedoutbySr i
yansDaga,MdAbdulRahmanandMdTousi fNoorunder
mygui danceduringthesession2020-
21andacceptedinparti
alf
ulf
il
lmentofthe
requi
rementforthedegreeofBachel
orOfTechnol
ogy.

Si
gnat
ure
Si
gnat
ure

Ari
ndam Chakr
avor
ty Ni
lanj
an
Karmakar
&
Ami
tSi
romoni

Head,Depar
tmentofI
nfor
mat
ionTechnol
ogy Depar
tmentofI
nfor
mat
ion
Technol
ogy

Depart
ment of I
nfor
mat
ion
T
Depare
tchnol
og
mentofIy
nf
ormat
ion Page
Technol
ogy 2
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
naly
earEi
ght
hSemest
erRepor
t

St
.Thomas’
Col
l
egeofEngi
neer
ingandTechnol
ogy

Acknowl
edgemen
t

Wewouldliket ot
hankfulourMent
or’sNil
anj
anaKar
makarand
AmitSi
romoni .Wi
ththeirhel
ptosuccessf
ull
ycompl
etedt
heproj
ect
(gamedevelopment).

Si
gnat
urewi
thdat
e

Sr
iyansDaga

Si
gnat
urewi
thdat
e

MdAbdulRahman

Si
gnat
urewi
thdat
e
MdTousi
fNoor

Depar
tmentofI
nfor
mat
ionTechnol
ogy

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 3
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearPr
ojectGui
del
i
ne

Vi
sion&Mi
ssi
on(St
.Thomas’
Col
legeofEngi
neer
ing
&Technol
ogy)

Vi
sion

Toevol
veitsel
fintoanindustryori
entedresearchbasedr ecognizedhubof
cr
eat
ive soluti
ons in v ar
ious fi
elds of engi neer
ing by est abl
ishi
ng
pr
ogr
essivet eachi
ng-l ear
ning process with an ulti
mat e objecti
v e of
meet
ingtechnologi
calchall
engesfacedbyt henationandthesoci ety.

Missi
o
n

 To cr eate opport unit


ies for student
s and f aculty member si n
acquiri
ng pr of
essionalknowl edge and developing socialat ti
tudes
withethicalandmor alvalues.
 To enhance t he qual it
y of engi neering educat i
on t hr
ough
accessible,comprehensi ve,indust
ryandr esearchor ient
edt eaching-
l
earningpr ocess.
 Tosat isfytheev er -
changingneedsoft henat i
onf orevolutionand
absorptionofsust ainableandenv i
ronmentfriendlytechnologies.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 4
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearPr
ojectGui
del
i
ne

Vi
sion&Mi
ssi
on(Depar
tmentofI
nfor
mat
ionTechnol
ogy)

Vi
sion

Topromotetheadvancementoflearni
nginI
nformati
onTechnol
ogythroughresear
ch
or
ienteddi
ssemi
nationofknowledgewhichwill
leadtoi
nnovat
iveappl
i
cationsof
i
nformati
oninI
ndustryandSoci
et y
.

Mi
ssi
on

 Toi
ncubat
est
udent
sgr
owi
ntoi
ndust
ryr
eadypr
ofessi
onal
s,pr
ofi
ci
entr
esear
ch
schol
arsandent erprisi
ngentrepreneur
s.
 Toc r
eatealearner-centricenvi
ronmentt hatmot
ivat
esthestudentsi
nadopt
ing
emergingtechnologiesoft herapidl
ychangingi
nformati
onsociety
.
 Top r
omotesoci al,envir
onment alandtechnol
ogi
calresponsi
venessamongthe
member softhef acultyandstudents.

Pr
ogr
am Educat
ionalObj
ect
ives(
PEO)

Gr
aduat
esofI
nfor
mat
ionTechnol
ogyPr
ogr
am shal
l

PEO1:Exhi
bittheski
ll
sandknowl
edger
equi
redt
odesi
gn,
dev
elopandi
mpl
ementI
T
sol
uti
onsforreall
if
eprobl
ems.

PEO2:
Excel
inpr
ofessi
onal
car
eer
,hi
ghereducat
ionandr
esear
ch.

PEO3:Demonstr
ateprof
essi
onal
ism,
entr
epreneur
ship,et
hical
behav
ior
,communicati
on
ski
l
lsandcol
laborat
ivet
eam wor
ktoadaptt
heemer gingtr
endsbyengagi
ngi
nli
felong
l
earni
ng.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 5
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearPr
oject
Gui
deli
ne PROGRAM OUTCOMES(
POs)

Engi
neer
ingGr
aduat
eswi
l
lbeabl
eto:

1. Engi
neer
ingknowledge:Appl
ytheknowledgeofmathemat
ics,sci
ence,engi
neer
ingf
undame
ntal
s,and
anengi
neer
ingspecial
i
zati
ontothesol
utionofcompl
exengine
er i
ngprobl
ems.

2. Pr
obl
em anal
ysi
s:I
dent
if
y,f
ormul
ate,r
evi
ew r
esear
chl
i
ter
atur
e,andanal
yzecompl
exengi
neer
ing
pr
obl
emsr
eac
hingsubst
ant
iat
edconcl
usi
onsusi
ngf
ir
stpr
inci
plesofmat
hemat
ics,nat
uralsci
ences,
ande
ngi
nee
ringsci
ences.

3. Desi
gn/
dev
elopmentofsol
uti
ons:Desi
gn sol
uti
onsf
or compl
exengi
neer
ingpr
obl
emsanddesi
gn
sy
stem component
sorpr
ocessest
hatmeett
hespeci
fi
edneedswi
thappr
opr
iat
econsi
der
ati
onf
ort
he
publ
i
cheal
thandsaf
ety
,andt
hecul
tur
al,
soci
etal
,ande
nvi
ronme
ntal
consi
der
ati
ons.

4. Conducti
nvest
igat
ionsofcompl
expr
obl
ems:User
esear
ch-
basedknowl
edgeandr
esear
chmet
hods
i
ncl
udi
ngdesi
gnofexper
ime
nts
,anal
ysi
sandi
nte
rpr
etat
ionofdat
a,andsy
nthesi
soft
hei
nfor
mat
ion
t
opr
ovi
dev
ali
dconcl
usi
ons.

5. Moder
ntoolusage:Cr
eat
e,sel
ect
,and appl
y appr
opr
iat
etechni
ques,r
esour
ces,and moder
n
e
ngi
nee
ringandI
Ttool
sincl
udi
ngpr
edi
cti
onandmodel
i
ngt
ocompl
exengi
neer
ingact
ivi
ti
eswi
than
unde
rst
andi
ngoft
hel
i
mit
ati
ons.

6. Theengi
neerandsoci
ety
:Appl
yreasoni
ngi
nfor
medbyt
hecont
ext
ualk
nowl
edget
oassesssoci
etal
,
heal
th,
saf
ety
,legal
andcul
tur
ali
ssuesandt
heconsequentr
esponsi
bil
i
tiesr
elev
antt
othepr
ofessi
onal
e
ngi
nee
ringpr
act
ice.

7. Env
ironmentandsust
ainabi
li
ty:Under
standt
hei
mpactoft
hepr
ofessi
onale
ngi
neer
ingsol
uti
onsi
n
soci
etalande
nvi
ronment
alcont
ext
s,anddemonst
rat
ethek
nowl
edgeof
,andneedf
orsust
ainabl
e
dev
elopment
.

8. Ethi
cs:Appl
yethi
calpri
nci
plesand commi
ttopr
ofessi
onalet
hicsandr
esponsi
bil
i
tiesandnor
msof
theengi
neer
ingpr
acti
ce.

9. I
ndi
vi
dualandt
eam wor
k:Funct
ionef
fect
ivel
yasani
ndi
vi
dual
,andasamemberorl
eaderi
ndi
ver
se
t
eams
,andi
nmul
ti
disci
pli
nar
yset
ti
ngs
.

10. Communi
cat
ion:Communi
cat
eef
fect
ivel
yoncompl
exengi
neer
ingact
ivi
ti
eswi
tht
hee
ngi
neer
ing
communi
tyandwi
thsoci
etyatl
arge,suchas,bei
ngabl
etocompr
ehe
ndandwr
it
eef
fect
iver
epor
ts
anddesi
gndocument
ati
on,
makeef
fect
ivepr
esent
ati
ons
,andgi
veandr
ecei
vecl
eari
nst
ruct
ions
.

11.Pr
ojectmanagementandf
inance:Demonst
rat
eknowl
edgeandunde
rst
andi
ngoft
heengi
neer
ingand
manageme
ntpr
inc
ipl
esandappl
ytheset
oone’
sownwor
k,asamemberandl
eaderi
nat
eam,t
o
managepr
oject
sandi
nmul
ti
disci
pli
nar
yenv
ironment
s.

12. Li
fe-
long l
earni
ng:Recogni
zet heneed for
,and havet hepr eparationand abil
i
tyt
o engagei
n
i
ndependentandl
ife-
longl
ear
ningint
hebroadestcont
extoftechnologicalchange.
Depart
mentofI
nfor
mat
ion Page
Technol
ogy 6
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearPr
ojectGui
del
i
ne
Pr
ojectMappi
ngwi
thPr
ogr
am Out
comes

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12

3 3 3 3 2 2 3 2 3 3 2 2

Ent
ercor
rel
ati
onl
evel
s1,
2or3asdef
inedbel
ow:

1:Sl
i
ght(
Low) 2:Moder
ate(
Medi
um) 3:Subst
ant
ial(
High)

Just
if
icat
ion:

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 7
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearPr
ojectGui
del
i
ne
Pr
ogr
am Speci
fi
cOut
comes(
PSOs)

Attheendoft
hepr
ogr
am t
hest
udent
swi
l
lbe
abl
eto

PSO1(Pr ogrammi ng):Appl


yt hepr ogr
ammi ngknowledgetobui
l
daneffici
entand
eff
ect
ivesoluti
onofthepr
obl
em withaner r
orfree,wel
ldocument
edandr
eusablecode,
userf
ri
endlyint
erf
aceandwell
organizeddatabase.

PSO2 ( Mul ti
media Aut hori
ng ) :Cr eat
e a mult
imedi
a product usi
ng proper
metaphor
,designi
ng ef f
ect i
ve navigati
on f ol
l
owi
ng human comput er i
nter
face
rul
es wi th pr operinteracti
vi
ty,whichwi l
lbeusef
ulforeducat
ional,soci
aland
busi
nesspurpose.

PSO3( Sof t
wareEngineeri
ng):Under standandanalyz
eabigcompl exproblem and
decomposeitintorel
ati
vel
ysmallerandindependentmodul
esei
theralgori
thmicall
yorin
anobjector
ientedwaychoosingcorrec
tlif
ecyclemodelandusi
ngeffectiv
etestcases.

Pr
oject Mappi
ng wi
th Pr
ogr
am Speci
fi
c
Out
comes

PSO1 PSO2 PSO3

3 3 3

Ent
ercor
rel
ati
onl
evel
s1,
2or3asdef
inedbel
ow:

1:Sl
i
ght(
Low) 2:Moder
ate(
Medi
um) 3:Subst
ant
ial(
High)

Just
if
icat
ion:

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 8
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearPr
ojectGui
del
i
ne

Fi
naly
earEi
ghthSemest
erRepor
t
Format
I
ndexPage,
donotputanypage
no

St
.Thomas’
Col
l
egeofEngi
neer
ingandTechnol
ogy

I
ndex

Topi
c PageNo

I
ntr
oduct
ion 1

Chapt
er1 11-
14

1.
1 Problem Stat
ement
1.
2 Problem Defi
nit
ion
1.
3 Objecti
ve
1.
4 ToolsandPl at
form
1.
5 Bri
efDiscussiononPr
obl
em

Chapt
er2 15

Concept
sandPr
obl
em anal
ysi
s

Chapt
er3 16

Desi
gnandMet
hodol
ogy

Chapt
er4 17-
26

Sampl
eCodes(i
f

any)Chapt
er5 27

Test
ing,
Resul
ts,
Discussi
ononResul
ts

Chapt
er6 28

6.
1Scopef
orf
utur
eimpr
ovement

6.
2Concl
usi
on

Annex
ure 29

Ref
erences/
Bibl
i
ogr
aphy

Depart
mentofInf
ormat
ionTec
hnol
ogy
DepartmentofI
nfor
mation Page
Technology 9
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
erRepor
t

I
NTRODUCTI
ON

Oursoftwareproj
ecti
sFlappyBird.I
t’
sagameappl icat
ion.Thegamewasdesi gnedandbuiltby
DongNguy en,adevel
operwhol i
vesinVietnam.Fl
appybirdisasi de-
scr
oll
ergamewher ethepl ay
er
cont
rolsabird,at
tempti
ngtoflybetweencolumnsofgreenpi pes.Thebir
dwi l
lbefly
ingunti
lit
col
li
sionswithapipeoritf
all
ongr ound.It
’sasimpl
egameofi nfi
nitel
evelt
ype.It
’sachall
enging
gamef oral
l.

Sof
twar
ePr
ojec
tDes
cri
pti
on

St
ory

Wechoosegameforourf
ir
stsoft
war
eproj
ect
.Act
ual
l
ygameisentert
ainingf
orany
bodyandin
l
eisur
eti
mewecanspendourtimeni
cel
ybypl
ayi
nggame.Thef
lappybirdgameimplement
edfor
mobil
eandaswel
lasdesktop.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 10
St.Thomas’Col
l
egeofEngineer
ingand
Technol
ogy
Fi
nal
YearEi
ghtSemester
Chapt
er1

1.
1Pr
obl
em St
atement:Fl
appyBi
rd2dgameusi
ngpy
thon.

1.
2Pr
obl
em Def
inat
ion: Thegamei
ssi
descr
oll
erwher
ethepl
ayercont
rol
sabi
rd,
att
empt
ingt
o
fl
y

bet
weenr
owsofgr
eenpi
peswi
thoutcomi
ngi
ntocont
actt
hem.
Ift
he
pl
ayer

t
ouchest
hepi
pes,
itendst
hegame.Thebi
rdbr
ief
lyf
lapsupwar
deach
t
ime

t
hepl
ayer
stapst
hescr
een;
ift
hescr
eeni
snott
apped,
thef
all
sduet
o

gr
avi
ty.

1.
3Object
ive:*Wecr
eat
eabi
rdobj
ectwhi
chi
sfl
yi
ngunt
ilanycol
l
isi
onoccur
redandt
hebi
rdi
s
fl
yi
ngi
n

t
hewal
lobj
ect
iveswhi
char
ebegi
nfr
om t
opandbot
tom oft
hescr
een.

*Thewal
lmov
ingonandi
twi
l
lcomer
andoml
yinsi
zeanddi
stances.Thebi
rdi
s
f
lyi
ngi
nthe

mi
ddl
eoft
hewal
l
.

*
Whent
hebi
rdt
oucht
heany
wher
eofawal
li
tcauseacol
l
isi
on.Col
l
isi
ondet
ect
ion
i
soneof

i
mpor
tantt
askoft
hegame.I
fthebi
rdt
ouchanywal
l(pi
pes)t
hegamewi
l
lend.

*Thepi
ctur
eusedasbackgr
oundi
magei
smov
ingonanal
ogousl
y.Weusedt
wo
same

i
mage whi
char
ecomi
ngoneaf
teranot
herr
egul
arl
y.

*Scor
ecount
ingi
sthei
nter
est
ingf
oruser
.Byt
hescor
ethepl
ayerknowshi
s/her

per
for
mance.I
fthebi
rdcr
ossapi
pewi
thoutcol
l
isi
onornotf
all
ingr
oundhi
s/her
scor
e

i
ncr
ementone.

1.
4Tool
s:Py
thon

1.
5P
Depl
a
at
rf
tor
me m
nt:
oV
fi
su
I
na
fl
oS
rt
maud
t
ii
o3
on.
9 Page
Technology 11
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 12
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er
1.
6Br
iefDi
scus
sionPr
obl
e Ourpr
m: oje
cti
sofFl
appyBi
r
dGame
.Iti
sapy
gamepr
ogr
amwr
i
tte
nin
pyt
hon.User
scanpla
ythi
sgameei
theronmobil
escreenorpl
ayitinthe
irc
omputer.
Itc
ontai
ns
onl
ysingl
epl
aymode s
.User
sca
ne nj
oythe
irbe
auti
fulsounde
ffe
c tandbackgr
ound,
userc
anpaly
thi
sgameinfi
ni
tet
i
me ,
the
rei
snospeci
fi
cti
metoe x
it.

Fol
l
owi
ngi
sthei
nst
ruct
ionofhowt
opl
ayt
hegame.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 13
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er
Thi
sist
hebac
kgr
ounds
ele
cti
onpage
.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 14
St.Thomas’Col
l
egeofEngineer
ingand
Technol
ogy
Fi
nal
YearEi
ghtSemester

Thi
sishowy
oucol
l
ectapoi
nt.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 15
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er
Chapt
er2

Conceptandpr
obl
em anal
ysi
s:I
t'
sdi
ff
icul
ttoexper
imentwi
thphy
sicsi
nthi
sgamewi
thout
dy
ing,
butf
rom myat
tempt
s,Ihav
edi
scov
eredt
hef
oll
owi
ng:

1.Thebirdacceler
atesduetogravi
ty;i
.e.ver
ti
cal v
elocit
yisalwaysi
ncreasingdownwards.
2.Butthere'
sacap.Youcan'tgofasterthanthisvelocit
ycap.
3.Nomat terthecurr
entvel
ocit
y,t
hebirdwi l
lgainthesameamountofhei ghtwhent hescreeni
s
tapped.
 
4.Therotati
onofthebirdiscor
rel
atedt oi
tsverti
cal v
eloci
ty.Ani
mati
on( f
lappi
ng)onlyoccurswhen
mov i
ngupwar ds.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 16
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er
Chapt
er3

Desi
gnandMet
hodol
ogy:
Ourdesi
gnpr
ocessi
stof
ir
stcr
eat
eal
lst
ati
cint
erf
acesand
but
tonsassoci
atedwi
theachint
erf
ace.Thenwest
artedt
ocreat
esi
ngleplayermode,i
ncl
udi
ng
pi
peandbackgroundshi
ft
ing,
bir
dfall
i
ngorjumpi
ng,scor
eandli
fet
racki
ng,soundeff
ect.

Fol
l
owi
ngi
sourpr
ojectschedul
e.

Task Deadl
ine

Pr
oposal Wi
thi
n3r
dweekofJanuar
y

Requi
rementAnal
ysi
s,Speci
fi
cat
ion Wi
thi
n20t
hJanuar
y

Desi
gni
ng,
Study Wi
thi
n3r
dMar
ch

Codi
ng Wi
thi
n1stApr
il

Fi
nal
Test
ing Wi
thi
n8May

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 17
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nal
YearEi
ghtSemest
er
Chapt
er4

Sampl
ecode:i
mpor
trandom #Forgener
ati
ngr
andom number
s

i
mpor
tsy
s#Wewi
l
lusesy
s.exi
ttoexi
tthepr
ogr
am

i
mpor
tpy
game

f
rom py
game.
local
simpor
t*#Basi
cpy
gamei
mpor
ts

#Gl
obal
Var
iabl
esf
ort
hegame

FPS=32

SCREENWI
DTH=289

SCREENHEI
GHT=511

SCREEN=py
game.
displ
ay.
set
_mode(
(SCREENWI
DTH,
SCREENHEI
GHT)
)

GROUNDY=SCREENHEI
GHT*0.
8

GAME_
SPRI
TES={
}

GAME_
SOUNDS={
}

PLAYER='
gal
l
ery
/spr
it
es/
bir
d.png'

BACKGROUND='
gal
l
ery
/spr
it
es/
backgr
ound.
png'

PI
PE='
gal
l
ery
/spr
it
es/
pipe.
png'

defwel
comeScr
een(
):

"
""

Showswel
comei
magesont
hescr
een

"
""

pl
ayer
x=i
nt(
SCREENWI
DTH/
5)
Depart
mentofI
nfor
mat
ion Page
Technol
ogy 18
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er

pl
ayer
y=i
nt(
(SCREENHEI
GHT-GAME_
SPRI
TES[
'
play
er'
]
.get
_hei
ght
())
/2)

messagex=i
nt(
(SCREENWI
DTH-GAME_
SPRI
TES[
'
message'
]
.get
_wi
dth(
))/
2)

messagey=i
nt(
SCREENHEI
GHT*
0.13)

basex=0

whi
l
eTr
ue:

f
orev
enti
npy
game.
event
.get
():

#i
fusercl
i
cksoncr
ossbut
ton,
closet
hegame

i
fev
ent
.t
ype==QUI
Tor(
event
.t
ype==KEYDOWNandev
ent
.key==K_
ESCAPE)
:

py
game.
qui
t(
)

sy
s.exi
t(
)

#I
ftheuserpr
essesspaceorupkey
,st
artt
hegamef
ort
hem

el
i
fev
ent
.t
ype==KEYDOWNand(
event
.key
==K_
SPACEorev
ent
.key==K_
UP)
:

r
etur
n

el
se:

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
backgr
ound'
]
,(0,
0))

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
play
er'
]
,(pl
ayer
x,pl
ayer
y))

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
message'
]
,(messagex,
messagey)
)

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
base'
]
,(basex,
GROUNDY)
)

py
game.
displ
ay.
updat
e()

FPSCLOCK.
ti
ck(
FPS)

defmai
nGame(
):

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 19
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nalYearEi
ghtSemest
er
scor
e=0

pl
ayer
x=i
nt(
SCREENWI
DTH/
5)

pl
ayer
y=i
nt(
SCREENWI
DTH/
2)

basex=0

#Cr
eat
e2pi
pesf
orbl
i
tti
ngont
hescr
een

newPi
pe1=get
RandomPi
pe(
)

newPi
pe2=get
RandomPi
pe(
)

#myLi
stofupperpi
pes

upper
Pipes=[

{
'x'
:SCREENWI
DTH+200,
'y'
:
newPi
pe1[
0][
'
y']
},

{
'x'
:SCREENWI
DTH+200+(
SCREENWI
DTH/
2),
'y'
:
newPi
pe2[
0][
'
y']
},

#myLi
stofl
owerpi
pes

l
ower
Pipes=[

{
'x'
:SCREENWI
DTH+200,
'y'
:
newPi
pe1[
1][
'
y']
},

{
'x'
:SCREENWI
DTH+200+(
SCREENWI
DTH/
2),
'y'
:
newPi
pe2[
1][
'
y']
},

pi
peVel
X=-
4

pl
ayer
Vel
Y=-
9

pl
ayer
Max
Vel
Y=10

player
MinVel
Y=-8
Depart
mentofInf
ormat
ion Page
Technol
ogy 20
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er

pl
ayer
AccY=1

pl
ayer
FlapAccv=-
8#v
eloci
tywhi
l
efl
appi
ng

pl
ayer
Flapped=Fal
se#I
tist
rueonl
ywhent
hebi
rdi
sfl
appi
ng

whi
l
eTr
ue:

f
orev
enti
npy
game.
event
.get
():

i
fev
ent
.t
ype==QUI
Tor(
event
.t
ype==KEYDOWNandev
ent
.key==K_
ESCAPE)
:

py
game.
qui
t(
)

sy
s.exi
t(
)

i
fev
ent
.t
ype==KEYDOWNand(
event
.key==K_
SPACEorev
ent
.key==K_
UP)
:

i
fpl
ayer
y>0:

pl
ayer
Vel
Y=pl
ayer
FlapAccv

pl
ayer
Flapped=Tr
ue

GAME_
SOUNDS[
'
wing'
]
.pl
ay(
)

crashTest=isColl
i
de(
play
erx,
play
ery
,upper
Pipes,
lower
Pipes)#Thi
sfunct
ionwi
l
lret
urnt
ruei
f
t
heplayeriscrashed

i
fcr
ashTest
:

r
etur
n

#checkf
orscore
Depart
mentofI
nformat
ion Page
Technol
ogy 21
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er

pl
ayer
MidPos=pl
ayer
x+GAME_
SPRI
TES[
'
play
er'
]
.get
_wi
dth(
)/2

f
orpi
pei
nupper
Pipes:

pi
peMi
dPos=pi
pe[
'
x']+GAME_
SPRI
TES[
'
pipe'
]
[0]
.get
_wi
dth(
)/2

i
fpi
peMi
dPos<=pl
ayer
MidPos<pi
peMi
dPos+4:

scor
e+=1

pr
int
(f"
Yourscor
eis{
scor
e}"
)

GAME_
SOUNDS[
'
poi
nt'
]
.pl
ay(
)

i
fpl
ayer
Vel
Y<pl
ayer
MaxVel
Yandnotpl
ayer
Flapped:

pl
ayer
Vel
Y+=pl
ayer
AccY

i
fpl
ayer
Flapped:

pl
ayer
Flapped=Fal
se

pl
ayer
Hei
ght=GAME_
SPRI
TES[
'
play
er'
]
.get
_hei
ght
()

pl
ayer
y=pl
ayer
y+mi
n(pl
ayer
Vel
Y,GROUNDY-pl
ayer
y-pl
ayer
Hei
ght
)

#mov
epi
pest
othel
eft

f
orupper
Pipe,
lower
Pipei
nzi
p(upper
Pipes,
lower
Pipes)
:

upper
Pipe[
'
x']+=pi
peVel
X

l
ower
Pipe[
'
x']+=pi
peVel
X

#Addanewpi
pewhent
hef
ir
sti
saboutt
ocr
osst
hel
eft
mostpar
toft
hescr
een

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 22
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er

i
f0<upper
Pipes[
0][
'
x']
<5:

newpi
pe=get
RandomPi
pe(
)

upper
Pipes.
append(
newpi
pe[
0])

l
ower
Pipes.
append(
newpi
pe[
1])

#i
fthepi
pei
soutoft
hescr
een,
remov
eit

i
fupper
Pipes[
0][
'
x']<-
GAME_
SPRI
TES[
'
pipe'
]
[0]
.get
_wi
dth(
):

upper
Pipes.
pop(
0)

l
ower
Pipes.
pop(
0)

#Let
sbl
i
tourspr
it
esnow

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
backgr
ound'
]
,(0,
0))

f
orupper
Pipe,
lower
Pipei
nzi
p(upper
Pipes,
lower
Pipes)
:

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
pipe'
]
[0]
,(upper
Pipe[
'
x']
,upper
Pipe[
'
y']
))

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
pipe'
]
[1]
,(l
ower
Pipe[
'
x']
,l
ower
Pipe[
'
y']
))

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
base'
]
,(basex,
GROUNDY)
)

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
play
er'
]
,(pl
ayer
x,pl
ayer
y))

my
Digi
ts=[
int
(x)f
orxi
nli
st(
str
(scor
e))
]

wi
dth=0

f
ordi
giti
nmy
Digi
ts:

wi
dth+=GAME_
SPRI
TES[
'
number
s']
[di
git
].
get
_wi
dth(
)

Xof
fset=(
SCREENWI
DTH-wi
dth)
/2

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 23
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy
Fi
nal
YearEi
ghtSEmest
er
f
ordi
giti
nmy
Digi
ts:

SCREEN.
bli
t(
GAME_
SPRI
TES[
'
number
s']
[di
git
],(
Xof
fset
,SCREENHEI
GHT*
0.12)
)

Xof
fset+=GAME_
SPRI
TES[
'
number
s']
[di
git
].
get
_wi
dth(
)

py
game.
displ
ay.
updat
e()

FPSCLOCK.
ti
ck(
FPS)

defi
sCol
l
ide(
play
erx,
play
ery
,upper
Pipes,
lower
Pipes)
:

i
fpl
ayer
y>GROUNDY-25orpl
ayer
y<0:

GAME_
SOUNDS[
'
hit
']
.pl
ay(
)

r
etur
nTr
ue

f
orpi
pei
nupper
Pipes:

pi
peHei
ght=GAME_
SPRI
TES[
'
pipe'
]
[0]
.get
_hei
ght
()

i
f(
play
ery<pipeHeight+pipe[
'y'
]andabs(
play
erx-pi
pe[
'
x']
)<
GAME_SPRITES[
'
pipe'
]
[0].
get_
wi dt
h())
:

GAME_
SOUNDS[
'
hit
']
.pl
ay(
)

r
etur
nTr
ue

f
orpi
pei
nlower
Pipes:

i
f(pl
ayery+GAME_ SPRI
TES[
'pl
ayer
']
.get
_hei
ght
()>pi
pe[
'
y']
)andabs(
play
erx-pi
pe[
'
x']
)<
GAME_SPRITES[
'
pipe'
]
[0].
get
_wi
dth(
):

GAME_
SOUNDS[
'
hit
']
.pl
ay(
)

r
etur
nTr
ue

r
etur
nFal
se

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 24
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er
defget
RandomPi
pe(
):

"
""

Generat
eposi
ti
onsoft
wopi
pes(
onebot
tom st
rai
ghtandonet
opr
otat
ed)f
orbl
i
tti
ngont
he
screen

"
""

pi
peHei
ght=GAME_
SPRI
TES[
'
pipe'
]
[0]
.get
_hei
ght
()

of
fset=SCREENHEI
GHT/
3

y
2=of f
set+r
andom.
randr
ange(
0,i
nt(
SCREENHEI
GHT-GAME_
SPRI
TES[
'
base'
]
.get
_hei
ght
()-1.
2
*
offset
))

pi
peX=SCREENWI
DTH+10

y
1=pi
peHei
ght-y
2+of
fset

pi
pe=[

{
'x'
:pi
peX,
'y'
:-
y1}
,#upperPi
pe

{
'x'
:pi
peX,
'y'
:y2}#l
owerPi
pe

r
etur
npi
pe

i
f__
name_
_=="
__mai
n__
":

#Thi
swi
l
lbet
hemai
npoi
ntf
rom wher
eourgamewi
l
lst
art

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 25
St
.Thomas’ CollegeofEngi
neer
ingand
py
game.
ini
t(
)Te
#Ic
nh
i
ti
an
lo
i
zel
o
ag
l
lpy
ygame'
smodul
es

FPSCLOCK=py
game.
ti
me.
Clock(
)

py
game.
displ
ay.
set
_capt
ion(
'Fl
appyBi
rdbyMdAbdul
Rahman'
)

Fi
nalYearEi
ghtSemest
er

GAME_
SPRI
TES[
'
number
s']=(

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
0.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
1.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
2.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
3.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
4.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
5.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
6.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
7.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
8.png'
).
conv
ert
_al
pha(
),

py
game.
image.
load(
'gal
l
ery
/spr
it
es/
9.png'
).
conv
ert
_al
pha(
),

GAME_
SPRI
TES[
'
message'
]=py
game.
image.
load(
'gal
l
ery
/spr
it
es/
message.
png'
).
conv
ert
_al
pha(
)

GAME_
SPRI
TES[
'
base'
]=py
game.
image.
load(
'gal
l
ery
/spr
it
es/
base.
png'
).
conv
ert
_al
pha(
)

GAME_
SPRI
TES[
'
pipe'
]=(
pygame.
tr
ansf
orm.
rot
ate(
pygame.
image.
load(PI
PE)
.conv
ert
_al
pha(
),
180),

py
game.
image.
load(
PIPE)
.conv
ert
_al
pha(
)

#Gamesounds
Depart
mentofI
nfor
mat
ion Page
Technol
ogy 26
St.Thomas’ CollegeofEngi neeringand
SOUNT
GAME_ e
DSc
[
' h
din
e'o
]=pl
o
yg
g y.
amemixer
.Sound(
'gal
l
ery
/audi
o/di
e.wav
')

GAME_
SOUNDS[
'
hit
']=py
game.
mixer
.Sound(
'gal
l
ery
/audi
o/hi
t.
wav
')

GAME_
SOUNDS[
'
poi
nt'
]=py
game.
mixer
.Sound(
'gal
l
ery
/audi
o/poi
nt.
wav
')

Fi
nalYearEi
ghtSemest
er

GAME_
SOUNDS[
'
swoosh'
]=py
game.
mixer
.Sound(
'gal
l
ery
/audi
o/swoosh.
wav
')

GAME_
SOUNDS[
'
wing'
]=py
game.
mixer
.Sound(
'gal
l
ery
/audi
o/wi
ng.
wav
')

GAME_
SPRI
TES[
'
backgr
ound'
]=py
game.
image.
load(
BACKGROUND)
.conv
ert
()

GAME_
SPRI
TES[
'
play
er'
]=py
game.
image.
load(
PLAYER)
.conv
ert
_al
pha(
)

whi
l
eTr
ue:

wel
comeScr
een(
)#Showswel
comescr
eent
otheuserunt
ilhepr
essesabut
ton

mai
nGame(
)#Thi
sist
hemai
ngamef
unct
ion

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 27
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er

Chapt
er5:

Test
ing:Wet
est
edourpr
ogr
am i
nthesamewayast
hedev
elopi
ngst
eps.Wet
est
edt
heov
eral
l
str
uctureofthegamebyt raversingeachinterf
ace,andtestt hesi ngl
eplay ermodebycheckingthe
updateofthescor eandli
fewhenbi r
dmov es.Onediff
icultyist hatweneedt heusertoi
nputNetID
tostorethei
rscore.However,py gamedoesnotcont ai
nt ype- i
nboxt ogett hekeyboardinput
.
Therefor
e,wewantanewi nterfaceandtransfert
hekey boar dinputt ostr
inganddr awthestr
ingon
thescreen.sofurt
herwewantt hedualpl
ay erimpl
ement ationinav eryshortperi
odoftime
becauseallthefucnti
onal
it
iesar ethesameasi nsingl
epl ay ermode.

Resul
ts:Ever
ythi
ngi
nourpr
ojectper
for
medaspl
annedandourt
eam meet
sthegoal
sout
li
ned
i
nt hedescri
ption.Wedesignedanewf l
appybi
rdgame.Inthedemo,weencour
agedprofessor
AKSSi randNKMadam t oplaythegame,whi
chgaveever
yonealotoff
un.Fi
nal
ly,
theprojectgot
thehighl
ypraisefrom pr
ofessorAKSSirandNKMadam.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 28
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er
Chapt
er6:

ScopeForFut
ureI
mpr
ovement:Wewi
l
laddmor
efeat
uret
othegameandwi
l
lchanget
he
bi
rdandbackgr
oundscener
yaccor
dingtouserchoi
ce.
weal soaddsi
ngl
etodual
modepl
ayer
game,
dayandnightmode,
weaddheat’
spointwhenwer eacg100poi
ntabov
e.

Concl
usi
on:
Ourf
inal
proj
ectwaspl
anned,
dev
elopedanddemonst
rat
edasexpect
ed.We
desi
gnedanewv ersi
onofFl appyBir
dGamewr i
tt
eninPyt
hon,whichcoul
dbepl ay
edei t
heron
mobilescr
eenorpersonalcomputer.Fi
rst
ly,
auser-f
ri
endl
yint
erf
acewasi mplemented.Secondl
y,
si
ngleplay
ermodewasr eal
i
zed,therei
snol i
mitoft
ime,t
hisi
sinfi
nit
eplaygameandt hereisno
i
ncreasi
ngspeedofreachingmaximum points.

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 29
St.Thomas’
Col
l
egeofEngi
neer
ingand
Technol
ogy

Fi
nalYearEi
ghtSemest
er

Bi
bli
ogr
aphy:

Py
thonr
efer
ence

Py
gamet
utor
ial
s

Py
gamedocument
s

Depart
mentofI
nfor
mat
ion Page
Technol
ogy 30

You might also like