/
level1.py
64 lines (52 loc) · 1.54 KB
/
level1.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
60
61
62
63
64
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from roomData import roomData
class Level(object):
NAME = 'House'
FLOOR_Y = [
344,
466,
588,
744
]
ROOMS = [
roomData(0, 240, 438, 'Office'),
roomData(0, 455, 653, 'Playroom'),
roomData(1, 240, 438, 'Bedroom'),
roomData(1, 455, 653, 'Bathroom'),
roomData(1, 679, 865, 'Laundry'),
roomData(2, 240, 438, 'TV room'),
roomData(2, 455, 653, 'Kitchen'),
roomData(2, 679, 912, 'Garage'),
roomData(3, 679, 912, 'Boiler room')
]
LIFT_X = 660
LIFT_MARGIN = 12
initial_player_position_x = 310
initial_floor = 0
initial_player_facing = 1
background_color = None
background_image = None
foreground_image = None
textures = {}
tilemap = []
TILESIZE=64
MAPWIDTH=0
MAPHEIGHT=0
def __init__(self, pygame):
self.background_image = pygame.image.load('./images/home_background.png')
self.foreground_image = pygame.image.load('./images/home_foreground.png')
def getFloorY(self, floor_index):
return self.FLOOR_Y[floor_index]
def getFloorIndex(self, y):
key = 0
for floor_y in self.FLOOR_Y:
if y < floor_y:
return key
key = key + 1
return 0
def getRoomName(self, x, floor):
for roomData in self.ROOMS:
if (roomData.floor == floor and x >= roomData.minX and x <= roomData.maxX):
return roomData.name
return str(x)