-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap_world.py
34 lines (30 loc) · 914 Bytes
/
map_world.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
"""
This module handles the map gestion of the scene.
Contains:
-the map
-all the walls-objects
-all the walls positions
"""
# LOCAL IMPORTS
import classes
import game_settings
map_array = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]
walls = []
walls_cord = []
for y, row in enumerate(map_array):
for x, tile in enumerate(row):
"""
We're iterating in the matrix and extracting x&y of each wall
"""
if tile:
walls_cord.append((x, y))
walls.append(classes.Wall((x * game_settings.TILE, y * game_settings.TILE)))