Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_dess_snowflake_Step_0

(view raw script w/o annotations or w/e)
1
if (stop_blowing)
2
{
3
    if (!is_blowing)
4
        exit;
5
    stop_blowing = false;
6
    is_blowing = false;
7
    angleV = 0.04;
8
}
9
if (start_blowing)
10
{
11
    if (is_blowing)
12
        exit;
13
    start_blowing = false;
14
    is_blowing = true;
15
    push = true;
16
    push_timer = 0;
17
    angle_temp = angle;
18
    angleV = 0;
19
    stop_timer = 0;
20
}
21
if (pull_down)
22
{
23
    pull_down = false;
24
    stop_timer = 0;
25
    angleV = -angleV;
26
    push_timer = 0;
27
}
28
if (push)
29
{
30
    push_timer++;
31
    if (push_timer == 1)
32
    {
33
        var target_angle = is_hit ? 1.5707963267948966 : 0.7853981633974483;
34
        scr_lerp_instance_var(id, "angle", angle_temp, target_angle, 4);
35
    }
36
    if (is_hit)
37
    {
38
        if (push_timer == 8)
39
        {
40
            if (!snowflake_finished)
41
            {
42
                snowflake_finished = true;
43
                with (obj_homealone_dess_closet_controller)
44
                    drop_ornament = true;
45
            }
46
            is_hit = false;
47
        }
48
    }
49
    if (push_timer >= 8)
50
    {
51
        var force = swing_gravity * sin(angle);
52
        angleA = (-1 * force) / len;
53
        angleV += angleA;
54
        if (!is_blowing)
55
        {
56
            angle += angleV;
57
            stop_timer++;
58
            if (stop_timer >= 240)
59
            {
60
                angleV *= 0.98;
61
                if (angleA < 0.00001 && force < 0.0001)
62
                {
63
                    angleV = 0;
64
                    angle = 0;
65
                }
66
            }
67
        }
68
    }
69
    x = (len * sin(angle)) + origin_x;
70
    y = (len * cos(angle)) + origin_y;
71
}