-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.py
More file actions
37 lines (29 loc) · 887 Bytes
/
game.py
File metadata and controls
37 lines (29 loc) · 887 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
import sys
import pygame
from enemies.BaseEnemy import BaseEnemy
class Game:
def __init__(self, width, height):
self.height = height
self.width = width
self.size = width, height
self.screen = pygame.display.set_mode(self.size)
# TODO Initialize all class veriables here
self.enemies = []
self.towers = []
self.base_enemy = BaseEnemy(10, 10)
def start(self):
while 1:
self.update()
self.draw()
def update(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
self.base_enemy.update()
def draw(self):
self.screen.fill([0, 0, 0])
self.base_enemy.draw(self.screen)
pygame.display.update()
def spawn_enemy(self):
self.enemies.append()