-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.py
154 lines (109 loc) · 10.2 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
from constants import *
from block import *
def generate_map(id):
if id == 0:
return map0()
elif id == 1:
return map1()
elif id == 2:
return map2()
elif id == 3:
return map3()
elif id == 4:
return map4()
else:
return no_map()
def no_map():
blocks = []
blocks.append(Block(0, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH, SCREEN_HEIGHT/30, Color.YELLOW.value, type="win")) #ground
blocks.append(Block(SCREEN_WIDTH/16 - SCREEN_WIDTH/80, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH/20, SCREEN_HEIGHT/60, Color.LIGHT_GREY.value, type="spawn")) #spawn point
return blocks
def map0():
blocks = []
blocks.append(Block(0, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH, SCREEN_HEIGHT/30, Color.GREEN.value)) #ground
blocks.append(Block(SCREEN_WIDTH/16 - SCREEN_WIDTH/80, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH/20, SCREEN_HEIGHT/60, Color.LIGHT_GREY.value, type="spawn")) #spawn point
blocks.append(Block(SCREEN_WIDTH*3/16, SCREEN_HEIGHT*13/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/2 - SCREEN_WIDTH/8, SCREEN_HEIGHT*11/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*3/4 - SCREEN_WIDTH/8, SCREEN_HEIGHT*9/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*11/32, SCREEN_HEIGHT*15/32, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*4/64, SCREEN_HEIGHT*12/32, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*7/32, SCREEN_HEIGHT*8/32, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*7/16, SCREEN_HEIGHT*3/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*43/64, SCREEN_HEIGHT*9/32, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*7/8, SCREEN_HEIGHT*3/16, SCREEN_WIDTH*3/80, SCREEN_HEIGHT/30, Color.YELLOW.value, type="win"))
return blocks
def map1():
blocks = []
blocks.append(Block(0, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH, SCREEN_HEIGHT/30, Color.GREEN.value)) #ground
blocks.append(Block(SCREEN_WIDTH/16 - SCREEN_WIDTH/80, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH/20, SCREEN_HEIGHT/60, Color.LIGHT_GREY.value, type="spawn")) #spawn point
#Mains horizontals platforms
blocks.append(Block(0, SCREEN_HEIGHT*3/4 - SCREEN_HEIGHT/30, SCREEN_WIDTH*13/16, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*3/16, SCREEN_HEIGHT/2 - SCREEN_HEIGHT/30, SCREEN_WIDTH*13/16, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(0, SCREEN_HEIGHT/4 - SCREEN_HEIGHT/30, SCREEN_WIDTH*13/16, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*15/16, SCREEN_HEIGHT*3/4 + SCREEN_HEIGHT/15, SCREEN_WIDTH/16, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(0, SCREEN_HEIGHT*5/8 - SCREEN_HEIGHT/16, SCREEN_WIDTH*3/64, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(0, SCREEN_HEIGHT/2 - SCREEN_HEIGHT/16, SCREEN_WIDTH/32, SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*3/16 - SCREEN_WIDTH/40, SCREEN_HEIGHT/2 - SCREEN_HEIGHT/8, SCREEN_WIDTH/40, SCREEN_HEIGHT/4, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/3, SCREEN_HEIGHT*9/16, SCREEN_WIDTH/40, SCREEN_HEIGHT*3/16 - SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/2, SCREEN_HEIGHT/2, SCREEN_WIDTH/40, SCREEN_HEIGHT*3/16 - SCREEN_HEIGHT/30 + SCREEN_HEIGHT/40, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*2/3, SCREEN_HEIGHT*9/16, SCREEN_WIDTH/40, SCREEN_HEIGHT*3/16 - SCREEN_HEIGHT/30, Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*7/8,SCREEN_HEIGHT*3/8 - SCREEN_HEIGHT/30, SCREEN_WIDTH/16,SCREEN_HEIGHT/30,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/32, SCREEN_HEIGHT/8 - SCREEN_HEIGHT/30, SCREEN_WIDTH*3/80, SCREEN_HEIGHT/30, Color.YELLOW.value, type="win"))
return blocks
def map2():
blocks = []
blocks.append(Block(0, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH, SCREEN_HEIGHT/30, Color.GREEN.value)) #ground
blocks.append(Block(SCREEN_WIDTH/16 - SCREEN_WIDTH/80, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH/20, SCREEN_HEIGHT/60, Color.LIGHT_GREY.value, type="spawn")) #spawn point
blocks.append(Block(SCREEN_WIDTH*3/16, SCREEN_HEIGHT*13/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH*3/4 - SCREEN_WIDTH/8, SCREEN_HEIGHT*9/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH*3/32, SCREEN_HEIGHT*12/32, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH*3/4 - SCREEN_WIDTH/8, SCREEN_HEIGHT*3/16, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH*28/32, SCREEN_HEIGHT/8 - SCREEN_HEIGHT/30, SCREEN_WIDTH*3/80, SCREEN_HEIGHT/30, Color.YELLOW.value, type="win"))
return blocks
def map3():
blocks = []
blocks.append(Block(SCREEN_WIDTH/16 - SCREEN_WIDTH/80, SCREEN_HEIGHT/10, SCREEN_WIDTH/20, SCREEN_HEIGHT/30, Color.LIGHT_GREY.value, type="spawn")) #spawn point
blocks.append(Block(0, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH, SCREEN_HEIGHT/30, Color.RED.value, type="lava")) #ground
blocks.append(Block((SCREEN_WIDTH - SCREEN_WIDTH/40)/2, 0, SCREEN_WIDTH/40, SCREEN_HEIGHT/2,Color.BLUE.value))
blocks.append(Block((SCREEN_WIDTH - SCREEN_WIDTH/40)/2, SCREEN_HEIGHT/2 + PLAYER_HEIGHT*3/2, SCREEN_WIDTH/40, SCREEN_HEIGHT/4,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*3/4,SCREEN_HEIGHT*3/4,SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block((SCREEN_WIDTH - SCREEN_WIDTH/40)/2 + SCREEN_WIDTH/40, SCREEN_HEIGHT/2 - SCREEN_HEIGHT/30, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block((SCREEN_WIDTH - SCREEN_WIDTH/40)/2 + SCREEN_WIDTH/40, SCREEN_HEIGHT/10 + SCREEN_HEIGHT/30, SCREEN_WIDTH/8, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH - (SCREEN_WIDTH/16 - SCREEN_WIDTH/80) - SCREEN_WIDTH/20, SCREEN_HEIGHT/10, SCREEN_WIDTH/20, SCREEN_HEIGHT/30, Color.YELLOW.value, type="win"))
return blocks
def map4():
blocks=[]
blocks.append(Block(SCREEN_WIDTH/16 - SCREEN_WIDTH/80, SCREEN_HEIGHT-SCREEN_HEIGHT/15, SCREEN_WIDTH/20, SCREEN_HEIGHT/30, Color.LIGHT_GREY.value, type="spawn")) #spawn point
blocks.append(Block(0, SCREEN_HEIGHT-SCREEN_HEIGHT/30, SCREEN_WIDTH, SCREEN_HEIGHT/30, Color.RED.value, type="lava")) #ground
blocks.append(Block(SCREEN_WIDTH - SCREEN_WIDTH/10, SCREEN_HEIGHT*2/15, SCREEN_WIDTH/10, SCREEN_HEIGHT*13/15,Color.RED.value, type="lava"))
#verticals
blocks.append(Block(SCREEN_WIDTH/4, SCREEN_HEIGHT/8, SCREEN_WIDTH/40, SCREEN_HEIGHT*7/8 - SCREEN_HEIGHT/30,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/40, SCREEN_HEIGHT*7/8 - SCREEN_HEIGHT/30,Color.BLUE.value))
#jump 1st part
blocks.append(Block(SCREEN_WIDTH/4 - SCREEN_WIDTH * 3/32, SCREEN_HEIGHT*3/4 + SCREEN_HEIGHT/30, SCREEN_WIDTH/16, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
blocks.append(Block(PLAYER_WIDTH*2, SCREEN_HEIGHT*3/8 + SCREEN_HEIGHT/20 + SCREEN_HEIGHT/30, SCREEN_WIDTH/16, SCREEN_HEIGHT/30, Color.BURGUNDY.value, type="jump"))
#lava in air
length_between_vertical = SCREEN_WIDTH/4 - SCREEN_WIDTH/40
#1st floor
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40, SCREEN_HEIGHT/4, length_between_vertical/4, SCREEN_HEIGHT/30,Color.RED.value, type="lava"))
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical/2, SCREEN_HEIGHT/4, length_between_vertical/2, SCREEN_HEIGHT/30,Color.RED.value, type="lava"))
#interfloor
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical/4, SCREEN_HEIGHT*3/8, length_between_vertical/4, SCREEN_HEIGHT/30,Color.BLUE.value))
#2nd floor
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40, SCREEN_HEIGHT/2, length_between_vertical*3/5, SCREEN_HEIGHT/30,Color.RED.value, type="lava"))
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical*4/5, SCREEN_HEIGHT/2, length_between_vertical/5, SCREEN_HEIGHT/30,Color.RED.value, type="lava"))
#interfloor
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical*3/5, SCREEN_HEIGHT*5/8, length_between_vertical/5, SCREEN_HEIGHT/30,Color.BLUE.value))
#3rd floor
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40, SCREEN_HEIGHT*3/4, length_between_vertical*1/6, SCREEN_HEIGHT/30,Color.RED.value, type="lava"))
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical*2/6, SCREEN_HEIGHT*3/4, length_between_vertical*4/6, SCREEN_HEIGHT/30,Color.RED.value, type="lava"))
#interfloor
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical*1/6, SCREEN_HEIGHT*7/8, length_between_vertical/6, SCREEN_HEIGHT/30,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical*3/5, SCREEN_HEIGHT*28/30, length_between_vertical/5, SCREEN_HEIGHT/60,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH/4 + SCREEN_WIDTH/40 + length_between_vertical, SCREEN_HEIGHT*57/60, length_between_vertical/5, SCREEN_HEIGHT/60,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*3/4, SCREEN_HEIGHT*57/60, length_between_vertical/5, SCREEN_HEIGHT/60,Color.BLUE.value))
blocks.append(Block(SCREEN_WIDTH*9/10 - length_between_vertical/10, SCREEN_HEIGHT*47/60, length_between_vertical/10, SCREEN_HEIGHT/60,Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH*5/8 - length_between_vertical/10, SCREEN_HEIGHT*5/8, length_between_vertical/10, SCREEN_HEIGHT/60,Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH*9/10- length_between_vertical/10, SCREEN_HEIGHT*3/8, length_between_vertical/10, SCREEN_HEIGHT/60,Color.BURGUNDY.value, type="jump"))
blocks.append(Block(SCREEN_WIDTH - (SCREEN_WIDTH/16 - SCREEN_WIDTH/80) - SCREEN_WIDTH/20, SCREEN_HEIGHT/10, SCREEN_WIDTH/20, SCREEN_HEIGHT/30, Color.YELLOW.value, type="win"))
return blocks