-
Notifications
You must be signed in to change notification settings - Fork 3
/
collisionScreen.py
33 lines (29 loc) · 1.05 KB
/
collisionScreen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pygame
import os
from bottomClass import Bottom
from pipeClass import Pipe
from birdClass import Bird
windowWidth = 600
windowHeight = 800
window = pygame.display.set_mode((windowWidth, windowHeight))
floorDimension = 730
backgroundPhoto = pygame.transform.scale2x(pygame.image.load(os.path.join("images", "bg.png")))
pygame.font.init()
sf = pygame.font.SysFont("comicsans", 50)
ef = pygame.font.SysFont("comicsans", 50)
class Collision:
def aiCollided(score):
win = window
bird = Bird(250, 310)
base = Bottom(floorDimension)
pipes = [Pipe(700)]
window.blit(backgroundPhoto, (0,0))
for pipe in pipes:
pipe.draw(window)
base.draw(win)
bird.draw(win)
scoreLabel = ef.render("Game Over!",1,(255,255,255))
window.blit(scoreLabel, (windowWidth - scoreLabel.get_width() - 190, 220))
scoreLabel = ef.render("Score: "+str(score),1,(255,255,255))
window.blit(scoreLabel, (windowWidth - scoreLabel.get_width() - 210, 370))
pygame.display.update()