-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
56 lines (38 loc) · 964 Bytes
/
main.py
File metadata and controls
56 lines (38 loc) · 964 Bytes
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
# Welcome to Zombie Knights
import pygame
import settings as gs
from board import Board
def setup():
#1 Setup engine
pygame.init()
#2 Display surface
screen = pygame.display.set_mode((gs.WINDOW_WIDTH, gs.WINDOW_HEIGHT))
#3 Caption
pygame.display.set_caption("Zombie Knight")
#4 Clock
clock = pygame.time.Clock()
#5 Return the goodies
return screen, clock
def main():
# Setup the game engine
screen, clock = setup()
# Create groups
tile_group = pygame.sprite.Group()
# Create game objects
board = Board(screen, tile_group)
# Testing (NOT PRODUCTION)
board.generate_level()
# Runtime variable
running = True
while running:
# Event loop
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Update the objects
board.draw()
pygame.display.update()
clock.tick(60)
pygame.quit()
if __name__ == "__main__":
main()