-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_Enemies_Boses.py
344 lines (324 loc) · 12.4 KB
/
create_Enemies_Boses.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
import random
from enemy import Enemy
from boss_1_a import Boss
from boss_2_a import Boss_2_a
from boss_1_b import Boss_1_b
from boss_2_b import Boss_2_b
WIDTH, HEIGHT = 1000, 700
# Create Enemies/Boses for Planet A.
def create_Planet_A_Enemies(player, enemies, level, wave_length):
"""
Create Enemies of Planet A
:param player: player
:param enemies: enemies
:param level: Int
:param wave_length: Int
:return: None
"""
rand_choice = None
if len(enemies) == 0:
if level <= 4:
wave_length += random.randrange(1, 2)
elif 4 < level < 9:
wave_length += random.randrange(1, 3)
elif 9 <= level < 20:
wave_length += random.randrange(1, 4)
for i in range(wave_length):
if level <= 4:
rand_choice = random.choice(["enemy_1", "enemy_2", "enemy_3"])
elif 4 < level <= 9:
rand_choice = random.choice(["enemy_1", "enemy_2", "enemy_3", "enemy_4"])
elif 9 < level < 21:
rand_choice = random.choice(["enemy_1", "enemy_2", "enemy_3", "enemy_4", "enemy_5"])
if level < 20:
enemy = Enemy(random.randrange(50, WIDTH - 200), random.randrange(-1000, -100),
rand_choice)
enemy.choice_img = rand_choice
enemies.append(enemy)
# ENEMY ATTR
if rand_choice == "enemy_1":
enemy.max_health = 10
enemy.health = enemy.max_health
enemy.health_y = -15
enemy.health_x = 12
enemy.shoot_x = - 70
enemy.shoot_y = - 35
if player.armor < 30:
enemy.damage = 20
elif player.armor >= 30:
enemy.damage = 10
elif player.armor >= 70:
enemy.damage = 5
elif player.armor == 100:
enemy.damage = 2
enemy.enemy_vel = 3
elif rand_choice == "enemy_2":
enemy.max_health = 20
enemy.health = enemy.max_health
enemy.health_y = 10
enemy.health_x = 5
enemy.shoot_x = - 65
enemy.shoot_y = - 65
if player.armor < 30:
enemy.damage = 30
elif player.armor >= 30:
enemy.damage = 20
elif player.armor >= 70:
enemy.damage = 10
elif player.armor == 100:
enemy.damage = 5
enemy.enemy_vel = 3
elif rand_choice == "enemy_3":
enemy.max_health = 30
enemy.health = enemy.max_health
enemy.health_y = 10
enemy.health_x = 5
enemy.shoot_x = - 65
enemy.shoot_y = - 65
if player.armor < 30:
enemy.damage = 35
elif player.armor >= 30:
enemy.damage = 25
elif player.armor >= 70:
enemy.damage = 15
elif player.armor == 100:
enemy.damage = 5
enemy.enemy_vel = 2
elif rand_choice == "enemy_4":
enemy.health = 40
enemy.max_health = enemy.health
enemy.health_y = -10
enemy.health_x = -10
enemy.shoot_x = - 70
enemy.shoot_y = - 50
if player.armor < 30:
enemy.damage = 40
elif player.armor >= 30:
enemy.damage = 30
elif player.armor >= 70:
enemy.damage = 20
elif player.armor == 100:
enemy.damage = 8
enemy.enemy_vel = 2
elif rand_choice == "enemy_5":
enemy.health = 100
enemy.max_health = enemy.health
enemy.health_x = - 120
enemy.health_y = - 150
enemy.shoot_x = - 135
enemy.shoot_y = - 80
if player.armor < 30:
enemy.damage = 50
elif player.armor >= 30:
enemy.damage = 30
elif player.armor >= 70:
enemy.damage = 25
elif player.armor == 100:
enemy.damage = 10
enemy.enemy_vel = 2
def create_Planet_A_Boss_1(player, boses):
"""
Creates Boss 1 of Planet A
:param player: player
:param boses: boses
:return:
"""
if len(boses) == 0:
boss = Boss(350, -300)
boss.health = 1000
boss.max_health = boss.health
boss.health_x = - 180
boss.health_y = 50
if player.armor < 30:
boss.damage = 10
elif player.armor >= 30:
boss.damage = 7
elif player.armor >= 70:
boss.damage = 5
elif player.armor == 100:
boss.damage = 3
boses.append(boss)
def create_Planet_A_Boss_2(player, boses_2_a):
"""
Creates Boss 2 of Plabet A
:param player: player
:param boses_2_a: boses_2_a
:return:
"""
if len(boses_2_a) == 0:
boss2 = Boss_2_a(250, -300)
boss2.health = 4000
boss2.max_health = boss2.health
boss2.health_x = - 140
boss2.health_y = - 20
if player.armor < 30:
boss2.damage = 40
elif player.armor >= 30:
boss2.damage = 25
elif player.armor >= 70:
boss2.damage = 10
elif player.armor == 100:
boss2.damage = 6
boses_2_a.append(boss2)
# Create Enemies/Boses for Planet B
def create_Planet_B_Enemies(player, level, enemies, wave_length):
"""
Creates Enemies of Planet B
:param player: player
:param level: Int
:param enemies: enemies
:param wave_length: Int
:return: None
"""
rand_choice = None
if len(enemies) == 0:
if level <= 4:
wave_length += random.randrange(1, 2)
elif 4 < level < 9:
wave_length += random.randrange(1, 3)
elif 9 <= level < 20:
wave_length += random.randrange(1, 4)
for i in range(wave_length):
if level <= 4:
rand_choice = random.choice(
['enemy_1_b', 'enemy_2_b', 'enemy_3_b'])
elif 4 < level <= 9:
rand_choice = random.choice(['enemy_1_b', 'enemy_2_b', 'enemy_3_b', 'enemy_4_b'])
elif 9 < level <= 14:
rand_choice = random.choice(['enemy_1_b', 'enemy_2_b', 'enemy_3_b',
'enemy_4_b', 'enemy_5_b'])
elif 15 < level < 20:
rand_choice = random.choice(['enemy_1_b', 'enemy_2_b', 'enemy_3_b',
'enemy_4_b', 'enemy_5_b', 'enemy_6_b'])
if level < 20:
enemy = Enemy(random.randrange(50, WIDTH - 200), random.randrange(-1000, - 100),
rand_choice)
enemy.choice_img = rand_choice
enemies.append(enemy)
# ENEMY ATTR
if rand_choice == "enemy_1_b":
enemy.max_health = 100
enemy.health = enemy.max_health
if player.armor < 30:
enemy.damage = 30
elif player.armor >= 30:
enemy.damage = 25
elif player.armor >= 70:
enemy.damage = 15
elif player.armor == 100:
enemy.damage = 10
enemy.enemy_vel = 2
enemy.shoot_x = - 40
enemy.shoot_y = - 40
elif rand_choice == "enemy_2_b":
enemy.max_health = 200
enemy.health = enemy.max_health
if player.armor < 30:
enemy.damage = 50
elif player.armor >= 30:
enemy.damage = 30
elif player.armor >= 70:
enemy.damage = 25
elif player.armor == 100:
enemy.damage = 10
enemy.enemy_vel = 3
enemy.shoot_x = - 40
enemy.shoot_y = - 40
elif rand_choice == "enemy_3_b":
enemy.max_health = 250
enemy.health = enemy.max_health
if player.armor < 30:
enemy.damage = 70
elif player.armor >= 30:
enemy.damage = 55
elif player.armor >= 70:
enemy.damage = 30
elif player.armor == 100:
enemy.damage = 15
enemy.enemy_vel = 2
enemy.shoot_x = - 40
enemy.shoot_y = - 40
elif rand_choice == "enemy_4_b":
enemy.max_health = 300
enemy.health = enemy.max_health
if player.armor < 30:
enemy.damage = 90
elif player.armor >= 30:
enemy.damage = 60
elif player.armor >= 70:
enemy.damage = 50
elif player.armor == 100:
enemy.damage = 30
enemy.enemy_vel = 2
enemy.shoot_x = - 40
enemy.shoot_y = - 40
elif rand_choice == "enemy_5_b":
enemy.max_health = 300
enemy.health = enemy.max_health
if player.armor < 30:
enemy.damage = 120
elif player.armor >= 30:
enemy.damage = 90
elif player.armor >= 70:
enemy.damage = 50
elif player.armor == 100:
enemy.damage = 25
enemy.enemy_vel = 2
enemy.shoot_x = - 80
enemy.shoot_y = - 65
elif rand_choice == "enemy_6_b":
enemy.max_health = 400
enemy.health = enemy.max_health
if player.armor < 30:
enemy.damage = 150
elif player.armor >= 30:
enemy.damage = 125
elif player.armor >= 70:
enemy.damage = 100
elif player.armor == 100:
enemy.damage = 75
enemy.enemy_vel = 1
enemy.shoot_x = - 80
enemy.shoot_y = - 70
def create_Planet_B_Boss_1(boses_1_b, player):
"""
Creates Boss 1 of Planet B
:param boses_1_b: boses_1_b
:param player: player
:return: None
"""
if len(boses_1_b) == 0:
boss_1_b = Boss_1_b(0, -300)
boss_1_b.x = WIDTH // 2 - boss_1_b.ship_img.get_width() // 2
boss_1_b.health = 5000
boss_1_b.max_health = boss_1_b.health
if player.armor < 30:
boss_1_b.damage = 25
elif player.armor >= 30:
boss_1_b.damage = 20
elif player.armor >= 70:
boss_1_b.damage = 15
elif player.armor == 100:
boss_1_b.damage = 10
boses_1_b.append(boss_1_b)
def create_Planet_B_Boss_2(boses_2_b, player):
"""
Creates Boss 2 of Planet B
:param boses_2_b: boses_2_b
:param player: player
:return: None
"""
if len(boses_2_b) == 0:
boss_2_b = Boss_2_b(0, - 300)
boss_2_b.x = WIDTH // 2 - boss_2_b.ship_img.get_width() // 2
boss_2_b.health = 10000
boss_2_b.max_health = boss_2_b.health
if player.armor < 30:
boss_2_b.damage = 250
elif player.armor >= 30:
boss_2_b.damage = 200
elif player.armor >= 70:
boss_2_b.damage = 170
elif player.armor == 100:
boss_2_b.damage = 150
boses_2_b.append(boss_2_b)