-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (41 loc) · 1.28 KB
/
main.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
import pygame
from direction import TextMessages as T
from game_master import GameMaster
border = 0.5
game_window_x = 12
game_window_y = 24
pixels = 30
pygame.init()
game_window = pygame.display.set_mode(
((game_window_x+border)*pixels, (game_window_y+border)*pixels))
b = GameMaster(game_window_x, game_window_x, pixels=pixels,
border=border, main_window=game_window)
b.surface_init(colour_key='Grey')
b.ai_place_ships()
clock = pygame.time.Clock()
game_started = False
while True:
for event in pygame.event.get():
print(event)
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
pygame.quit()
if not game_started:
b.move_ship(event)
b.ship_placement(event)
if not game_started:
b.temp_ship_control()
b.intro_draw()
b.draw_text(T.intro1, 1, 13, 22)
b.draw_text(T.intro2, 2, 15, 18)
b.draw_text(T.intro3, 2, 16, 18)
b.draw_text(T.intro4, 2, 17, 18)
game_started = b.intro_completed()
game_started = b.intro_completed()
if game_started:
b.gameplay_draw_bottom()
b.gameplay_draw_top()
b.play(game_started)
clock.tick(30)