Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_thrash_laserbullet_old_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    init = 1;
4
    if (attackdirection == 1)
5
    {
6
        finalpoint = 1;
7
        points[1][0] = __view_get(e__VW.XView, 0) - 80;
8
        points[1][1] = y;
9
    }
10
    else
11
    {
12
        points[1][0] = x;
13
        points[1][1] = y + (100 * (attackdirection - 1));
14
        points[2][1] = points[1][1];
15
    }
16
}
17
if (nextpoint <= finalpoint)
18
{
19
    if (nextpoint == 2)
20
    {
21
        if ((x - 10) <= (obj_heart.x + 8))
22
        {
23
            x = obj_heart.x + 8;
24
            points[2][0] = x;
25
            points[3][0] = x;
26
            if (attackdirection == 2)
27
                points[3][1] = __view_get(e__VW.YView, 0) - 80;
28
            else
29
                points[3][1] = __view_get(e__VW.YView, 0) + 580;
30
            nextpoint++;
31
        }
32
        else
33
        {
34
            x -= 15;
35
        }
36
    }
37
    else
38
    {
39
        x = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); }
(x, points[nextpoint][0], 15);
40
        y = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); }
(y, points[nextpoint][1], 15);
41
        if (point_distance(x, y, points[nextpoint][0], points[nextpoint][1]) <= 0)
42
            nextpoint++;
43
    }
44
}
45
46
enum e__VW
47
{
48
    XView,
49
    YView,
50
    WView,
51
    HView,
52
    Angle,
53
    HBorder,
54
    VBorder,
55
    HSpeed,
56
    VSpeed,
57
    Object,
58
    Visible,
59
    XPort,
60
    YPort,
61
    WPort,
62
    HPort,
63
    Camera,
64
    SurfaceID
65
}