-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattacks.py
191 lines (179 loc) · 8.85 KB
/
attacks.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
from random import Random
import projectiles
SCREEN_WIDTH = 512
SCREEN_HEIGHT = 740
def CircleSpawner(loc, div, kind, offset, bullets, sprites):
bullet_counter = 0
angle = 360 / div
while bullet_counter < div:
if kind == "w":
new_bullet = projectiles.WarblyBullet(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "s":
new_bullet = projectiles.SpiralBullet(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "s2":
new_bullet = projectiles.SpiralBullet2(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "s3":
new_bullet = projectiles.SpiralBullet3(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "s3i":
new_bullet = projectiles.SpiralBullet3Inverse(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "s4":
new_bullet = projectiles.SpiralBullet4(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "s4i":
new_bullet = projectiles.SpiralBullet4Inverse(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "b2":
new_bullet = projectiles.Bullet2(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "cr":
new_bullet = projectiles.BulletCross(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "ma":
new_bullet = projectiles.BulletModA(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "mb":
new_bullet = projectiles.BulletModB(loc.x, loc.y, bullet_counter * angle + offset)
elif kind == "bd":
new_bullet = projectiles.BulletBarD(loc.x, loc.y, bullet_counter * angle + offset)
else:
new_bullet = projectiles.Bullet(loc.x, loc.y, bullet_counter * angle + offset)
bullets.add(new_bullet)
sprites.add(new_bullet)
bullet_counter += 1
def BarSpawner(loc_y, div, angle, kind, bullets, sprites):
bullet_counter = 0
space = SCREEN_WIDTH / div
rand = Random()
range = int(round(div / 8))
bound = rand.randint(0, div - range)
while bullet_counter < div:
if bullet_counter < bound or bullet_counter > bound + range:
if kind == "w":
new_bullet = projectiles.WarblyBullet(space * bullet_counter + 13, loc_y, angle)
elif kind == "s":
new_bullet = projectiles.SpiralBullet(space * bullet_counter + 13, loc_y, angle)
elif kind == "s2":
new_bullet = projectiles.SpiralBullet2(space * bullet_counter + 13, loc_y, angle)
elif kind == "s3":
new_bullet = projectiles.SpiralBullet3(space * bullet_counter + 13, loc_y, angle)
elif kind == "s3i":
new_bullet = projectiles.SpiralBullet3Inverse(space * bullet_counter + 13, loc_y, angle)
elif kind == "s4":
new_bullet = projectiles.SpiralBullet4(space * bullet_counter + 13, loc_y, angle)
elif kind == "s4i":
new_bullet = projectiles.SpiralBullet4Inverse(space * bullet_counter + 13, loc_y, angle)
elif kind == "b2":
new_bullet = projectiles.Bullet2(space * bullet_counter + 13, loc_y, angle)
elif kind == "cr":
new_bullet = projectiles.BulletCross(space * bullet_counter + 13, loc_y, angle)
elif kind == "ma":
new_bullet = projectiles.BulletModA(space * bullet_counter + 13, loc_y, angle)
elif kind == "mb":
new_bullet = projectiles.BulletModB(space * bullet_counter + 13, loc_y, angle)
elif kind == "bd":
new_bullet = projectiles.BulletBarD(space * bullet_counter + 13, loc_y, angle)
else:
new_bullet = projectiles.Bullet(space * bullet_counter + 13, loc_y, angle)
bullets.add(new_bullet)
sprites.add(new_bullet)
bullet_counter += 1
def QuarterSpawner(loc, div, kind, offset, bullets, sprites):
bullet_counter = 0
angle = 90 / div
while bullet_counter < div:
if kind == "w":
new_bullet = projectiles.WarblyBullet(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "s":
new_bullet = projectiles.SpiralBullet(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "s2":
new_bullet = projectiles.SpiralBullet2(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "s3":
new_bullet = projectiles.SpiralBullet3(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "s3i":
new_bullet = projectiles.SpiralBullet3Inverse(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "s4":
new_bullet = projectiles.SpiralBullet4(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "s4i":
new_bullet = projectiles.SpiralBullet4Inverse(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "b2":
new_bullet = projectiles.Bullet2(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "cr":
new_bullet = projectiles.BulletCross(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "ma":
new_bullet = projectiles.BulletModA(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "mb":
new_bullet = projectiles.BulletModB(loc.x, loc.y, bullet_counter * angle + 45 + offset)
elif kind == "bd":
new_bullet = projectiles.BulletBarD(loc.x, loc.y, bullet_counter * angle + 45 + offset)
else:
new_bullet = projectiles.Bullet(loc.x, loc.y, bullet_counter * angle + 45 + offset)
bullets.add(new_bullet)
sprites.add(new_bullet)
bullet_counter += 1
def Stream(loc, angle, kind, bullets, sprites):
if kind == "w":
new_bullet = projectiles.WarblyBullet(loc.x, loc.y, angle + 90)
elif kind == "s":
new_bullet = projectiles.SpiralBullet(loc.x, loc.y, angle + 90)
elif kind == "s2":
new_bullet = projectiles.SpiralBullet2(loc.x, loc.y, angle + 90)
elif kind == "s3":
new_bullet = projectiles.SpiralBullet3(loc.x, loc.y, angle + 90)
elif kind == "s3i":
new_bullet = projectiles.SpiralBullet3Inverse(loc.x, loc.y, angle + 90)
elif kind == "s4":
new_bullet = projectiles.SpiralBullet4(loc.x, loc.y, angle + 90)
elif kind == "s4i":
new_bullet = projectiles.SpiralBullet4Inverse(loc.x, loc.y, angle + 90)
elif kind == "b2":
new_bullet = projectiles.Bullet2(loc.x, loc.y, angle + 90)
elif kind == "cr":
new_bullet = projectiles.BulletCross(loc.x, loc.y, angle)
elif kind == "ma":
new_bullet = projectiles.BulletModA(loc.x, loc.y, angle)
elif kind == "mb":
new_bullet = projectiles.BulletModB(loc.x, loc.y, angle)
elif kind == "bd":
new_bullet = projectiles.BulletBarD(loc.x, loc.y, angle)
else:
new_bullet = projectiles.Bullet(loc.x, loc.y, angle + 90)
bullets.add(new_bullet)
sprites.add(new_bullet)
def Gatling(loc, div, dir, width, count, kind, bullets, sprites):
pos = count % div
angle = 0
if dir == "right":
angle = 0
loc.y += (pos * width) - ((div * width) / 2)
elif dir == "down":
angle = 90
loc.x += (pos * width) - ((div * width) / 2)
elif dir == "left":
angle = 180
loc.y += (pos * width) - ((div * width) / 2)
elif dir == "up":
angle = 270
loc.x += (pos * width) - ((div * width) / 2)
if kind == "w":
new_bullet = projectiles.WarblyBullet(loc.x, loc.y, angle)
elif kind == "s":
new_bullet = projectiles.SpiralBullet(loc.x, loc.y, angle)
elif kind == "s2":
new_bullet = projectiles.SpiralBullet2(loc.x, loc.y, angle)
elif kind == "s3":
new_bullet = projectiles.SpiralBullet3(loc.x, loc.y, angle)
elif kind == "s3i":
new_bullet = projectiles.SpiralBullet3Inverse(loc.x, loc.y, angle)
elif kind == "s4":
new_bullet = projectiles.SpiralBullet4(loc.x, loc.y, angle)
elif kind == "s4i":
new_bullet = projectiles.SpiralBullet4Inverse(loc.x, loc.y, angle)
elif kind == "b2":
new_bullet = projectiles.Bullet2(loc.x, loc.y, angle)
elif kind == "cr":
new_bullet = projectiles.BulletCross(loc.x, loc.y, angle)
elif kind == "ma":
new_bullet = projectiles.BulletModA(loc.x, loc.y, angle)
elif kind == "mb":
new_bullet = projectiles.BulletModB(loc.x, loc.y, angle)
elif kind == "bd":
new_bullet = projectiles.BulletBarD(loc.x, loc.y, angle)
else:
new_bullet = projectiles.Bullet(loc.x, loc.y, angle)
bullets.add(new_bullet)
sprites.add(new_bullet)