今日の雑記

生きることでいっぱいいっぱい

今日の a24z

さらしてみる。とある敵のスクリプト


#include "common.a24zh"

def start() -> void :
let:
i = 0
tx = 0.0
ty = 0.0
vx = 0.0
vy = 0.0
ax = 0.0
ay = 0.0
in:
px = possetx(0, POS_NONE)
py = get_rand()
py = -64.0 * py
py = -240.0 + py
py = possety(2, py)
if px < 0.0:
tx = get_rand()
tx = tx * 64.0
tx = px + tx + 32.0
else:
tx = get_rand()
tx = tx * 64.0
tx = px - tx - 32.0
ty = py + 208.0
yield

while i < 10:
vx = px
vy = py
px = px + ((tx - px) / 5.0)
py = py + ((ty - py) / 5.0)
vx = px - vx
vy = py - vy
i = i + 1
yield

i = 0
tx = px
ty = py
ax = vx / 16.0
ay = vy / 8.0
if ax < 0.0:
ax = -ax
if ay < 0.0:
ax = -ay

while i < 300:
if px < tx:
vx = vx + ax
else:
vx = vx - ax
if py < ty:
vy = vy + ay
else:
vy = vy - ay
px = px + vx
py = py + vy
i = i + 1
yield

while 1:
px = px + vx
py = py + vy
yield

こういう、多段階の制御に向いてますね。これをベタで組むかと思うと、もう、そりゃ・・・。