-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (46 loc) · 1.32 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
import pygame,sys
from Grid import *
from Cell import *
from pygame.locals import *
def run_game():
screen_height=400
screen_width=400
screen = pygame.display.set_mode((screen_height, screen_width),0,32)
BG_COLOR = 255,255,255
clock=pygame.time.Clock()
cell_image="cell.png"
world = Grid(screen,40,40,cell_image)
world.setCell(5,5,True)
world.setCell(6,5,True)
world.setCell(7,5,True)
world.setCell(8,6,True)
world.setCell(6,6,True)
world.setCell(7,6,True)
world.setCell(5,10,True)
world.setCell(6,5,True)
world.setCell(7,10,True)
world.setCell(8,10,True)
world.setCell(6,6,True)
world.setCell(7,6,True)
world.setCell(20,6,True)
world.setCell(20,7,True)
world.setCell(21,6,True)
world.setCell(21,7,True)
world.setCell(22,9,True)
world.setCell(22,8,True)
world.setCell(23,9,True)
world.setCell(23,8,True)
screen.fill(BG_COLOR)
count =0
while True: # main game loop
time_passed = clock.tick(3)
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
for i in range(world.getRows()):
for j in range(world.getCols()):
world.getCell(i,j).blitme()
world.updateCells()
pygame.display.update()
run_game()