forked from stlucasgarcia/connect-four
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstarter_screen.py
66 lines (54 loc) · 1.98 KB
/
starter_screen.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import pygame as pg
import sys
import time
from itertools import cycle
from settings import Settings
class InitScreen:
def __init__(self, screen) -> None:
self.config = Settings()
self.screen = screen
self.bg_classic = pg.image.load(
"data\images\starter\classic\starter_screen.png"
)
self.bg_halloween = pg.image.load(
"data\images\starter\halloween\starter_screen.png"
)
self.bg_vaporwave = pg.image.load(
"data\images\starter\\vaporwave\starter_screen.png"
)
self.bg_christmas = pg.image.load(
"data\images\starter\christmas\starter_screen.png"
)
self.bg_old_west = pg.image.load(
"data\images\starter\old_west\starter_screen.png"
)
self.size = self.config.size
if self.size == (1280, 720):
self.bg_classic = pg.transform.scale(self.bg_classic, (1280, 720))
self.bg_halloween = pg.transform.scale(self.bg_halloween, (1280, 720))
self.bg_vaporwave = pg.transform.scale(self.bg_vaporwave, (1280, 720))
self.bg_christmas = pg.transform.scale(self.bg_christmas, (1280, 720))
self.bg_old_west = pg.transform.scale(self.bg_old_west, (1280, 720))
def starter_screen(self):
Clock = pg.time.Clock()
backgrounds = cycle(
[
self.bg_classic,
self.bg_halloween,
self.bg_vaporwave,
self.bg_old_west,
self.bg_christmas,
]
)
startGame = True
while startGame == True:
for event in pg.event.get():
if event.type == pg.KEYDOWN:
if event.key == pg.K_ESCAPE:
sys.exit()
startGame = False
return
self.screen.blit(next(backgrounds), (0, 0))
pg.display.update()
time.sleep(1.5)
Clock.tick(60)