Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_vent_airflow_particle_Step_0

(view raw script w/o annotations or w/e)
1
px = 0;
2
py = 0;
3
wspeed = 0;
4
siner += (0.09 * sine_speed);
5
move_amount_x = 1;
6
move_amount_y = 1;
7
var airflow_area = collision_rectangle(x, y - 5, x + sprite_width, y + sprite_height + 15, obj_homealone_vent_airflow, false, true);
8
if (airflow_area != -4)
9
{
10
    if (airflow_area.image_index == 0)
11
    {
12
        move_right = true;
13
        var bottom_area = collision_rectangle(x - 6, y + sprite_height, x + sprite_width, y + sprite_height + 4, obj_homealone_vent_airflow, false, true);
14
        if (bottom_area != -4 && bottom_area.image_index == 2)
15
        {
16
            py -= 1;
17
            siner = 0;
18
        }
19
        else
20
        {
21
            px += 4;
22
            py -= (sin(siner) * 0.2);
23
        }
24
    }
25
    if (airflow_area.image_index == 1)
26
    {
27
        var top_area = collision_rectangle(x, y - 2, x + sprite_width, y + 2, obj_homealone_vent_airflow, false, true);
28
        if (top_area != -4 && top_area.image_index == 3)
29
            py += 1;
30
        else
31
            px -= 4;
32
        py += (sin(siner) * 0.2);
33
        move_right = false;
34
    }
35
    if (airflow_area.image_index == 2)
36
        py -= 4;
37
    if (airflow_area.image_index == 3)
38
    {
39
        var left_area = collision_rectangle(x - 4, y, x + sprite_width, y, obj_homealone_vent_airflow, false, true);
40
        if (left_area != -4 && left_area.image_index == 0)
41
            px += 4;
42
        py += 4;
43
    }
44
}
45
if (airflow_area == -4)
46
{
47
    if (move_right)
48
        py += 1;
49
    else
50
        py -= 1;
51
}
52
x += (px * speed_multipler);
53
y += (py * speed_multipler);