-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplayingWindow.py
50 lines (43 loc) · 1.66 KB
/
playingWindow.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import pygame
import os
from bottomClass import Bottom
from pipeClass import Pipe
from birdClass import Bird
windowWidth = 600
windowHeight = 800
pygame.display.init()
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", 30)
play = False
class PlayWindow:
def drawStartWindow():
win = window
bird = Bird(250, 310)
base = Bottom(floorDimension)
pipes = [Pipe(700)]
score = 0
window.blit(backgroundPhoto, (0,0))
for pipe in pipes:
pipe.draw(window)
base.draw(win)
bird.draw(win)
scoreLabel = sf.render("Score: " + str(score),1,(255,255,255))
window.blit(scoreLabel, (windowWidth - scoreLabel.get_width() - 220, 10))
scoreLabel = sf.render("AI Trained!",1,(255,255,255))
window.blit(scoreLabel, (windowWidth - scoreLabel.get_width() - 190, 220))
scoreLabel = sf.render("Press any key to play.",1,(255,255,255))
window.blit(scoreLabel, (windowWidth - scoreLabel.get_width() - 60, 370))
pygame.display.update()
def drawPlayWindow(window, bird, pipes, bottom, score):
window.blit(backgroundPhoto, (0,0))
for pipe in pipes:
pipe.draw(window)
bottom.draw(window)
bird.draw(window)
scoreLabel = sf.render("Score: " + str(score),1,(255,255,255))
window.blit(scoreLabel, (windowWidth - scoreLabel.get_width() - 15, 10))
pygame.display.update()