Deltarune script viewer

← back to main script listing

gml_Object_obj_thrash_laserbullet_long_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    active = 1;
4
    init = 1;
5
    if (attackdirection == 1)
6
    {
7
        finalpoint = 2;
8
        targetx = obj_growtangle.x + 100;
9
    }
10
    else
11
    {
12
        targety = obj_growtangle.y + (100 * (attackdirection - 1));
13
        direction = (attackdirection == 0) ? 90 : 270;
14
        image_angle = direction;
15
    }
16
}
17
if (lasertimer > 0)
18
{
19
    tailx = 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); }
(tailx, x, laserspeed);
20
    taily = 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); }
(taily, y, laserspeed);
21
    lasertimer--;
22
    if (lasertimer == 0)
23
    {
24
        if (attackdirection == 1)
25
            targetx = __view_get(e__VW.XView, 0) - 20;
26
        nextpoint++;
27
    }
28
}
29
else if (nextpoint <= finalpoint)
30
{
31
    if (nextpoint == 2 && attackdirection != 1)
32
    {
33
        if ((x - laserspeed) <= (obj_heart.x + 10))
34
        {
35
            x = obj_heart.x + 10;
36
            targetx = x;
37
            if (attackdirection == 2)
38
                targety = __view_get(e__VW.YView, 0) - 20;
39
            else
40
                targety = __view_get(e__VW.YView, 0) + 500;
41
            lasertimer = 20;
42
        }
43
        else
44
        {
45
            x -= laserspeed;
46
        }
47
    }
48
    else if (lasertimer <= 0)
49
    {
50
        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, targetx, laserspeed);
51
        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, targety, laserspeed);
52
        if (point_distance(x, y, targetx, targety) <= 0)
53
        {
54
            if (nextpoint < finalpoint)
55
                lasertimer = (attackdirection == 1) ? 20 : 10;
56
            else
57
                nextpoint++;
58
        }
59
    }
60
}
61
if (grazed == 1)
62
{
63
    if (grazetimer == 0)
64
    {
65
        grazetimer = 5;
66
    }
67
    else
68
    {
69
        grazetimer--;
70
        if (grazetimer == 0)
71
            grazed = 0;
72
    }
73
}
74
75
enum e__VW
76
{
77
    XView,
78
    YView,
79
    WView,
80
    HView,
81
    Angle,
82
    HBorder,
83
    VBorder,
84
    HSpeed,
85
    VSpeed,
86
    Object,
87
    Visible,
88
    XPort,
89
    YPort,
90
    WPort,
91
    HPort,
92
    Camera,
93
    SurfaceID
94
}