Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_chaseenemy_Step_2

(view raw script w/o annotations or w/e)
1
if (alertcon >= 1 && frozen == 0 && ignoresolid == 0)
2
{
3
    if (slide == 0)
4
    {
5
        if (collision_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, obj_solidblock, false, true) || collision_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom, obj_solidenemy, false, true))
6
        {
7
            x -= hspeed;
8
            y -= vspeed;
9
            hspeed = 0;
10
            vspeed = 0;
11
        }
12
    }
13
    if (slide == 1)
14
    {
15
        var repositioned = 0;
16
        if (place_meeting(x, y, obj_solidblock) || place_meeting(x, y, obj_solidenemy))
17
        {
18
            if (!place_meeting(x - hspeed, y, obj_solidblock) && !place_meeting(x - hspeed, y, obj_solidenemy))
19
            {
20
                x -= hspeed;
21
                repositioned = 1;
22
            }
23
            if (!repositioned && !place_meeting(x, y - vspeed, obj_solidblock) && !place_meeting(x, y - vspeed, obj_solidenemy))
24
            {
25
                y -= vspeed;
26
                repositioned = 1;
27
            }
28
            if (!repositioned)
29
            {
30
                x -= hspeed;
31
                y -= vspeed;
32
            }
33
        }
34
    }
35
}
36
if (pacetype == 11)
37
{
38
    if (global.interact == 0)
39
    {
40
        if (path_speed == 0)
41
            path_speed = pathSpeed;
42
    }
43
    else
44
    {
45
        path_speed = 0;
46
    }
47
}
48
if (customhitbox == 1)
49
    hitvar = collision_rectangle(x + hitx1, y + hity1, x + hitx2, y + hity2, obj_mainchara, true, true);
50
if ((place_meeting(x, y, obj_mainchara) && customhitbox == 0) || (customhitbox == 1 && hitvar != -4))
51
{
52
    if (global.interact == 0 || global.interact == 4)
53
    {
54
        if (encounterflag > 0)
55
            global.flag[54 encounter_pointer] = encounterflag;
56
        event_user(0);
57
    }
58
}