Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_halo_whirl_Step_0

(view raw script w/o annotations or w/e)
1
switch (state)
2
{
3
    case "spinup":
4
        x = camerax() + x_start;
5
        spin_speed += 0.05;
6
        if (spin_speed > 0.2)
7
            image_alpha = clamp(image_alpha + 0.05, 0, 1);
8
        if (spin_speed >= 1.5)
9
        {
10
            image_alpha = 1;
11
            state = "move_to_end";
12
            move_across_time = 0;
13
        }
14
        break;
15
    case "move_to_end":
16
        move_across_time++;
17
        x = camerax() + ease_inout_sine(move_across_time, x_start, x_end - x_start, move_across_duration);
18
        if (move_across_time == move_across_duration)
19
        {
20
            state = "spindown";
21
            move_across_time = 0;
22
        }
23
        break;
24
    case "move_to_start":
25
        move_across_time++;
26
        x = camerax() + ease_inout_sine(move_across_time, x_end, x_start - x_end, move_across_duration);
27
        if (move_across_time == move_across_duration)
28
            state = "spindown";
29
        break;
30
    case "spindown":
31
        spin_speed -= 0.05;
32
        image_alpha -= 0.05;
33
        if (spin_speed <= 0)
34
        {
35
            spin_speed = 0;
36
            state = "done";
37
        }
38
        break;
39
    case "done":
40
        instance_destroy();
41
        break;
42
}
43
with (obj_heroparent)
44
    image_speed = clamp(other.spin_speed, 0, 1);
45
whirl_xoffset += (((clamp(other.spin_speed, 0, 1) * 0.5) + 0.5) / 40);
46
whirl_xoffset %= 1;
47
whirl_yoffset += 0.02;
48
whirl_yoffset %= 1;