-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.py
59 lines (54 loc) · 3.51 KB
/
map.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
50
51
52
53
54
55
56
57
58
59
import pygame as pg
from settings import *
_ = False
# NO are where there is a passageway normally but ghosts decide they want to leave the maze so I closed the maze
NO = 1
mini_map = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, _, 1, 1, _, _, _, 1, 1, _, 1],
[1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1],
[1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1],
[1, _, _, _, _, _, _, _, _, _, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1],
[1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1],
[1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1],
[1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1],
[1, _, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 1, 1, _, _, _, _, 1],
[1, _, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, 1, _, _, 1, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, 1, 1, 1, _, 1, _, _, _, _, _, _, 1, _, 1, 1, 1, 1, 1, 1, 1, _, 1],
[1, _, _, _, _, _, _, _, _, _, 1, _, _, _, _, _, _, 1, _, _, _, _, _, _, _, _, _, 1],
[1, _, 1, 1, 1, 1, 1, 1, 1, _, 1, _, _, _, _, _, _, 1, _, 1, 1, 1, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, _, 1],
[1, _, _, _, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, _, 1, 1, _, _, _, _, _, _, 1],
[1, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, 1],
[1, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, 1],
[NO, _, _, _, 1, 1, _, _, _, _, _, _, _, 1, 1, _, _, _, _, _, _, _, 1, 1, _, _, _, NO],
[1, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, 1],
[1, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, 1],
[1, _, _, _, _, _, _, _, _, _, 1, 1, _, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, _, _, _, _, _, _, _, _, _, _, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, 1, 1, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, _, 1, 1, 1, 1, 1, _, 1, 1, 1, 1, _, 1],
[1, _, _, _, _, _, _, _, _, _, _, _, _, 1, 1, _, _, _, _, _, _, _, _, _, _, _, _, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]
class Map:
def __init__(self, game):
self.game = game
self.mini_map = mini_map
self.world_map = {}
self.get_map()
def get_map(self):
for j, row in enumerate(self.mini_map):
for i, value in enumerate(row):
if value:
self.world_map[(i, j)] = value
def draw(self):
[pg.draw.rect(self.game.screen, 'darkblue',
(pos[0] * RESIZE, pos[1] * RESIZE, RESIZE, RESIZE),
2)
for pos in self.world_map]