Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions flappyBird.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,30 @@

pygame.init()
#setto gli sfondi
decision=random.randint(0,1)
if decision==1:
sfondo=pygame.image.load('immagini/sfondo.png')
else:
sfondo=pygame.image.load('immagini/notte.jpg')
player=pygame.image.load('immagini/uccello.png')
base=pygame.image.load('immagini/base.png')
gameOver=pygame.image.load('immagini/gameover.png')
tuboGiu=pygame.image.load('immagini/tubo.png')
tuboSu=pygame.transform.flip(tuboGiu,False,True)#immagine da trasformare, fli orizz, flip verticale
FONT = pygame.font.SysFont('arial.ttf', 50)
try:
decision=random.randint(0,1)
except Exception as e:
raise e("There was an error at line 7 with generating a random number")
try:
if decision==1:
sfondo=pygame.image.load('immagini/sfondo.png')
else:
sfondo=pygame.image.load('immagini/notte.jpg')
player=pygame.image.load('immagini/uccello.png')
base=pygame.image.load('immagini/base.png')
gameOver=pygame.image.load('immagini/gameover.png')
tuboGiu=pygame.image.load('immagini/tubo.png')
tuboSu=pygame.transform.flip(tuboGiu,False,True)#immagine da trasformare, fli orizz, flip verticale
FONT = pygame.font.SysFont('arial.ttf', 50)
except Exception as e:
raise e("There was an error at lines 11-20 with loading the sprites")

schermo=pygame.display.set_mode((288,512))
FPS=50
AVANZA=3
try:
schermo=pygame.display.set_mode((288,512))
FPS=50
AVANZA=3
except Exception as exc:
raise exc("An error occured at lines 19-21 with setting up a few settings")

class tubiClass:
def __init__(self):
Expand Down Expand Up @@ -132,4 +141,4 @@ def perdita():
for tubo in tubi:
tubo.collisione(player,playerX,playerY)
disegna()
aggiorna()
aggiorna()