Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_overworld_knight_sword2_Step_0

(view raw script w/o annotations or w/e)
1
var _cx = camerax();
2
var _cy = cameray();
3
if (placed == false || cameratrack_x == true)
4
    x = _cx + xpos;
5
if (placed == false || cameratrack_y == true)
6
    y = _cy + ypos;
7
placed = true;
8
if (image_alpha < 1)
9
{
10
    MoveSword(-1);
11
    image_alpha += 0.1;
12
}
13
if ((timer < 18 && obj_mainchara.x < 360) || vanish)
14
{
15
    vanish = true;
16
    image_alpha -= 0.25;
17
    if (image_alpha <= 0)
18
        instance_destroy();
19
    exit;
20
}
21
timer += 1;
22
if (timer == 1)
23
{
24
    snd_stop(snd_knight_jump_quick);
25
    snd_play_x(snd_knight_jump_quick, 0.5, 1.3);
26
}
27
if (timer >= 10 && timer < (10 + spring_length))
28
{
29
    if (!alwaystrack_x)
30
        cameratrack_x = false;
31
    image_blend = merge_color(c_white, c_red, max(0, (timer - 10 - (spring_length - 18)) / 18));
32
    var ypos_spring = ystart - lengthdir_y(52, direction);
33
    var xpos_spring = xstart - lengthdir_x(52, direction);
34
    ypos = lerp(ypos, ypos_spring, (timer - 10) / spring_length);
35
    xpos = lerp(xpos, xpos_spring, (timer - 10) / spring_length);
36
}
37
if (timer == (10 + spring_length))
38
{
39
    con = y;
40
    MoveSword(600);
41
    snd_stop(snd_knight_cut2);
42
    snd_play_x(snd_knight_cut2, 0.5, 1.3);
43
}
44
if (timer == (10 + spring_length + 2))
45
{
46
    var _xp = lengthdir_x(24, direction + 90);
47
    var _yp = lengthdir_y(24, direction + 90);
48
    var _x1 = x - _xp;
49
    var _y1 = y - _yp;
50
    var _x2 = ((cameratrack_x == true) ? _cx : x) + _xp;
51
    var _y2 = ((cameratrack_y == true) ? _cy : y) + _yp;
52
    if (murder || (global.inv < 0 && i_ex(obj_mainchara) && point_in_rectangle(charaHeartX(), charaHeartY(), (_x1 < _x2) ? _x1 : _x2, (_y1 < _y2) ? _y1 : _y2, (_x1 > _x2) ? _x1 : _x2, (_y1 > _y2) ? _y1 : _y2)))
53
    {
54
        event_user(5);
55
        with (obj_dw_churchc_darkswords)
56
        {
57
            if (kris.x > darkness_super_endx)
58
            {
59
                darkness_hits++;
60
                wound = true;
61
                wound_heavy = other.heavy;
62
            }
63
        }
64
    }
65
}
66
if (timer == (10 + spring_length + 2))
67
    instance_destroy();
68
image_angle = direction;