-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__main__.py
44 lines (36 loc) · 1 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
from PIL import Image
from src import *
# all combined=357 lines of code......actually not that much
WIDTH = 16
HEIGHT = 8
def main():
pygame.init()
clock = pygame.time.Clock()
base = [
[
(i % (HEIGHT - 1)) * (j % (WIDTH - 1)) > 0
for j in range(WIDTH)
] for i in range(HEIGHT)
]
game = Game(base)
win = pygame.display.set_mode((500, 500))
game.create_level('assets/levels/tilemap.png', base, win)
width, height = size = (game.level.width, game.level.height)
win = pygame.display.set_mode(size)
rect = pygame.rect.Rect
walls = [
rect(0, 0, width, 64),
rect(width-64, 0, 64, height),
rect(0, height-64, width, 64),
rect(0, 0, 64, height)
]
frame_count = 0
while True:
if frame_count % 10 == 0:
game.player.update_frame_index()
game.loop(win, walls)
pygame.display.update()
clock.tick(60)
frame_count += 1
if __name__ == '__main__':
main()