-
Notifications
You must be signed in to change notification settings - Fork 1
/
LevelPiece.py
42 lines (32 loc) · 957 Bytes
/
LevelPiece.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
class LevelPiece():
def __init__(self, pos, boxes, spikes, lava, start_height, end_height):
self.pos = pos
boxes_pos = []
for b in boxes:
boxes_pos += [b.pos]
spikes_pos = []
for s in spikes:
spikes_pos += [s.pos]
lava_pos = []
for l in lava:
lava_pos += [l.pos]
self.boxes = boxes_pos
self.spikes = spikes_pos
self.lava = lava_pos
self.start_height = start_height
self.end_height = end_height
def get_all_spikes(self):
return self.spikes
def get_all_lava(self):
return self.lava
def get_all_boxes(self):
return self.boxes
def get_last_piece_x(self):
last_x = 0
for b in self.boxes:
if b[0] > last_x:
last_x = b[0]
for s in self.spikes:
if s[0] > last_x:
last_x = s[0]
return last_x