recycleD/game.py

41 lines
805 B
Python

import pygame
pygame.init()
import grid as grod
import workers
import ring
running=False
objs=[]
def main():
screen=pygame.display.set_mode((1280,720))
clock=pygame.time.Clock()
global running; running=True
act=0
grid=grod.Grid(8,8,64,12,11)
grid.add_worker(workers.behaviours.Cursor)
grid.add_worker(workers.behaviours.Average)
grid.add_tower(5,5)
grid.add_tower(3,4,'cannon',2)
objs.append(grid)
while running:
update()
draw(screen)
clock.tick(60)
pygame.quit()
def update():
events=pygame.event.get()
for event in events:
if event.type==pygame.QUIT: global running; running=False
if event.type==pygame.KEYDOWN: print(event)
for obj in objs:
obj.update(events)
def draw(screen):
screen.fill((64,128,64))
for obj in objs:
obj.draw(screen)
pygame.display.flip()
main()