@@ -24,6 +24,29 @@ function border_of_wave_and_particle(self)
24
24
end
25
25
end
26
26
27
+ function mk_wander (x ,y ,w ,h ,accel ,period )
28
+ x = x or 300
29
+ y = y or 40
30
+ w = w or 200
31
+ h = h or 170
32
+ accel = accel or 30
33
+ period = period or 120
34
+ return function (self )
35
+ while true do
36
+ self :wait (period )
37
+ -- Choose a random spot to wander to
38
+ local xx = random (w ) + x
39
+ local yy = random (h ) + y
40
+ local r , theta = get_polar (xx - self .x , yy - self .y )
41
+ self :change_speed (r / accel , accel )
42
+ self :change_direction (theta , 1 )
43
+ self :wait (accel )
44
+ self :change_speed (0 , accel )
45
+ self :wait (accel )
46
+ end
47
+ end
48
+ end
49
+
27
50
function mokou_wander (self )
28
51
local x , other_x , y , h , accel = {}, {475 }, 0 , 120 , 30
29
52
for i = 325 ,450 ,25 do other_x [# other_x + 1 ] = i x [# x + 1 ] = i + 12.5 end
@@ -90,6 +113,61 @@ function grid(self)
90
113
Object ({x =- 25 , y =- 50 , direction = facing_down , speed = 50 , kind = " spawner" }, trace_a )
91
114
end
92
115
116
+ function archimedes (self )
117
+ local child = function (self , start_angle , b , c )
118
+ local r ,theta = 0 ,0
119
+ c = c / 60 * tau
120
+ local c_x , c_y = self .x , self .y
121
+ local offset_x , offset_y
122
+ while true do
123
+ theta = theta + c
124
+ r = b * theta
125
+ offset_x ,offset_y = get_cartesian (r , theta + start_angle )
126
+ self .x = c_x + offset_x
127
+ self .y = c_y + offset_y
128
+ self :wait (1 )
129
+ end
130
+ end
131
+ local c , k , direction = 1 / 5 , 1 , 1
132
+ local n = 7
133
+ while true do
134
+ self :wait (max (400 * c ,7 ))
135
+ print (max (400 * c ,7 ))
136
+ c = 1 / 5 / (1.3 + .02 * rank * k )
137
+ k = k + 1
138
+ direction = - direction
139
+ self .child_color = colors .blue
140
+ for i = 0 ,n - 1 do
141
+ self :fire ({edge_margin = 400 }, {child , i * tau / n + direction * k * tau / 70 , 100 , c * direction })
142
+ end
143
+ end
144
+ end
145
+
146
+ function small_adds (self )
147
+ local child = function (self , wait_time )
148
+ self :wait (wait_time )
149
+ local direction = self :aim ()
150
+ local gchild = function (self )
151
+ self :change_speed (0 ,1 )
152
+ for i = 1 ,3 do
153
+ self :wait (4 )
154
+ self :fire ({direction = direction , speed = 8 })
155
+ end
156
+ self :vanish ()
157
+ end
158
+ self :fire ({direction = direction - tau / 4 , speed = 25 }, gchild )
159
+ self :fire ({direction = direction + tau / 4 , speed = 25 }, gchild )
160
+ self :vanish ()
161
+ end
162
+ while true do
163
+ for i = 0 ,3 do
164
+ self :wait (50 )
165
+ self .child_color = colors .white
166
+ self :fire ({edge_margin = 200 ,direction = random ()* tau , speed = 1 / 3 }, {child , 490 - 50 * i })
167
+ end
168
+ end
169
+ end
170
+
93
171
function add_laters (first , ...)
94
172
stuff = {... }
95
173
for idx ,data in ipairs (stuff ) do
@@ -98,11 +176,54 @@ function add_laters(first, ...)
98
176
return first , unpack (stuff )
99
177
end
100
178
179
+ function zander (self )
180
+ local mkguy = function (k )
181
+ return function (self )
182
+ self :change_speed (0 ,1 )
183
+ self .child_color = colors .white
184
+ while true do
185
+ wait (30 )
186
+ local direction = self :aim ()
187
+ for j = 1 ,3 - abs (k ) do
188
+ self :fire ({direction = direction + 4 * degrees * k ,speed = 5 + j })
189
+ end
190
+ end
191
+ end
192
+ end
193
+ local c_x = 400
194
+ local c_y = 400
195
+ local r = 350
196
+ for i =- 2 ,2 do
197
+ -- cos = x, -sin = y
198
+ local theta = facing_up + 25 * degrees * i
199
+ local my_x ,my_y = get_cartesian (r ,theta )
200
+ my_x = my_x + c_x
201
+ my_y = my_y + c_y
202
+ local speed ,direction = get_polar (my_x - self .x , my_y - self .y )
203
+ self :fire ({direction = direction ,speed = speed }, mkguy (i ))
204
+ end
205
+ self :vanish ()
206
+ --[[ for i=-2,2 do
207
+ self:fire({direction=facing_left, speed=130*i}, mkguy(3-abs(i)))
208
+ end--]]
209
+ --[[ while true do
210
+ wait(30)
211
+ local direction = self:aim()
212
+ for i=-2,2 do
213
+ for j=0,2-abs(i) do
214
+ self:fire({direction=direction+i*4*degrees,speed=6+j})
215
+ end
216
+ end
217
+ end--]]
218
+ end
219
+
101
220
function stage_one (junk , key )
102
221
local patterns = {
222
+ {{later , 30 * 60 , Object .vanish , 0 }, zander },
103
223
{{later , 22.5 * 60 , Object .vanish , 60 }, border_of_wave_and_particle },
104
224
{{later , 15 * 60 , Object .vanish , 360 }, mokou_197 , mokou_wander },
105
- -- {{later, 5*60, Object.vanish, 0}, grid}
225
+ {{later , 5 * 60 , Object .vanish , 0 }, grid },
226
+ {{later , 23 * 60 , Object .vanish , 0 }, archimedes , mk_wander (), small_adds },
106
227
}
107
228
local boss = nil
108
229
for idx ,data in ipairs (shuffle (patterns )) do
0 commit comments