Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shadowman_sax_attack_Step_0

(view raw script w/o annotations or w/e)
1
if (!init)
2
{
3
    init = true;
4
    depth = obj_heart.depth + 1;
5
    path_set_kind(mypath, 1);
6
    path_set_precision(mypath, 4);
7
    path_set_closed(mypath, 0);
8
    var relativeY = 0;
9
    path_add_point(mypath, x, y, 100);
10
    path_add_point(mypath, x - 30, y - 20, 100);
11
    var boxy = obj_growtangle.y;
12
    for (i = 1; i < 5; i++)
13
    {
14
        var xpoint = (-150 * i) + x;
15
        if (aim_at_player && relativeY == 0 && (xpoint - (obj_heart.x + 10)) <= 150)
16
        {
17
            relativeY = random_range(-80 * i, 80 * i) + boxy;
18
            path_add_point(mypath, xpoint, relativeY, 100);
19
            relativeY = ((obj_heart.y + 10) - relativeY) / abs((obj_heart.x + 10) - xpoint);
20
        }
21
        else if (aim_at_player && relativeY != 0)
22
        {
23
            relativeY = obj_heart.y + 10 + (relativeY * abs((obj_heart.x + 10) - xpoint));
24
            path_add_point(mypath, xpoint, clamp(relativeY, (-80 * i) + boxy, (80 * i) + boxy), 100);
25
            relativeY = 0;
26
        }
27
        else
28
        {
29
            path_add_point(mypath, xpoint, random_range(-100 * i, 100 * i) + boxy, 100);
30
        }
31
    }
32
}
33
if (!freeze && instance_exists(obj_shutta_rotation_attack) && obj_shutta_rotation_attack.freeze)
34
    freeze = true;
35
if (freeze)
36
    exit;
37
if ((animchange == (1 & progressLoop)) > (attackWaitTime + 1))
38
{
39
    if (instance_exists(sax_animation))
40
        sax_animation.image_speed = 0.16666666666666666;
41
    animchange = 0;
42
}
43
if (firedShots >= bulletCount)
44
{
45
    timer++;
46
    if (timer >= destroytime)
47
        instance_destroy();
48
    exit;
49
}
50
if (progressLoop > attackWaitTime || draw_style == 0)
51
{
52
    if (timer >= shootSpeed)
53
    {
54
        if (animchange == 0)
55
        {
56
            if (instance_exists(sax_animation))
57
                sax_animation.image_speed = 1/3;
58
            animchange = 1;
59
            snd_stop(shadowman_sax_long_1);
60
            snd_stop(shadowman_sax_long_2);
61
            snd_stop(shadowman_sax_long_3);
62
            snd_stop(shadowman_sax_long_4);
63
            snd_stop(shadowman_sax_long_solo_note);
64
            var rand = choose(0, 1, 2, 3, 4);
65
            if (rand == 0)
66
                snd_play_x(shadowman_sax_long_1, 1, 1);
67
            if (rand == 1)
68
                snd_play_x(shadowman_sax_long_2, 1, 1);
69
            if (rand == 2)
70
                snd_play_x(shadowman_sax_long_3, 1, 1);
71
            if (rand == 3)
72
                snd_play_x(shadowman_sax_long_4, 1, 1);
73
            if (rand == 4)
74
                snd_play_x(shadowman_sax_long_solo_note, 1, 1);
75
        }
76
        d = 
scr_bullet_create
scr_bullet_create

function
scr_bullet_create(arg0, arg1, arg2)
{ var __newbullet = instance_create(arg0, arg1, arg2); __newbullet.damage = damage; __newbullet.target = target; if (variable_instance_exists(self, "element")) __newbullet.element = element; return __newbullet; }
(x, y, obj_shadowman_sax_bullet);
77
        d.grazepoints = grazepoints;
78
        d.childgraze = childgraze;
79
        d.direction = point_direction(x, y, path_get_x(mypath, 0.02), path_get_y(mypath, 0.02));
80
        timer = 0;
81
        d.bulletPath = mypath;
82
        if (special >= 1 && firedShots == 1)
83
            d.spawnchild = special;
84
        firedShots++;
85
    }
86
    else
87
    {
88
        timer++;
89
    }
90
    exit;
91
}