1 |
if (global.interact == 0) |
2 |
{ |
3 |
centerx = (camerax() + 320) - (sprite_width / 2); |
4 |
if (con == 0) |
5 |
{ |
6 |
vspeed = -8; |
7 |
image_speed = 0; |
8 |
if (y <= startTarget) |
9 |
{ |
10 |
image_speed = 0.2; |
11 |
if (image_index >= 4) |
12 |
{ |
13 |
con = 1; |
14 |
sprite_index = spr_ch2_gimmick_saucer_ufo; |
15 |
image_speed = 0.2; |
16 |
image_index = 0; |
17 |
vspeed = 0; |
18 |
increment = choose(0.04, 0.05, 0.06, 0.07, 0.08); |
19 |
} |
20 |
if (x != centerx) |
21 |
x = lerp(x, centerx, 0.25); |
22 |
} |
23 |
} |
24 |
if (con == 1) |
25 |
{ |
26 |
timer++; |
27 |
if (timer == timer1 || timer == timer2 || timer == timer3) |
28 |
{ |
29 |
snd_play_x(snd_laz_c, 0.5, 0.7); |
30 |
snd_play_x(snd_laz_c, 0.6, 2); |
31 |
bullet = instance_create(x + 50, y + 65, obj_saucer_ufo_bullet); |
32 |
bullet.damage = 10; |
33 |
bullet.target = 3; |
34 |
} |
35 |
if (timer == (timer3 + 10)) |
36 |
con = 2; |
37 |
steptimer += increment; |
38 |
desx = centerx + (sin(steptimer) * 280); |
39 |
x = lerp(x, desx, 0.05); |
40 |
y += (sin(steptimer) / 4); |
41 |
} |
42 |
if (con == 2) |
43 |
{ |
44 |
if (hspeed == 0) |
45 |
hspeed = 1; |
46 |
hspeed *= 1.2; |
47 |
hspeed = clamp(hspeed, 0, 30); |
48 |
if (x > (camerax() + 640 + (sprite_width * 2))) |
49 |
instance_destroy(); |
50 |
} |
51 |
} |