Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_tracking_swords_manager_Step_0

(view raw script w/o annotations or w/e)
1
if (global.turntimer < 70)
2
    exit;
3
timer++;
4
if ((timer == rate && swordcount <= maxswords) || (timer == multiswordframes && multiswordcon == 1))
5
{
6
    inst = instance_create(x, y, obj_tracking_sword1);
7
    inst.direction = choose(0, 45, 90, 135, 180, 225, 270, 315);
8
    inst.variant = variant;
9
    inst.damage = damage;
10
    repeat (8)
11
    {
12
        for (i = 0; i < 8; i++)
13
        {
14
            if (inst.direction == directionprev[i])
15
                inst.direction += 45;
16
        }
17
    }
18
    inst.image_angle = inst.direction + 180;
19
    directionprev[swordcount] = inst.direction;
20
    for (i = 1; i < 4; i++)
21
    {
22
        var _a = i + swordcount;
23
        if (_a > 7)
24
            _a -= 7;
25
        directionprev[_a] = -1;
26
    }
27
    swordcount++;
28
    if (swordcount > maxswords && variant == 0)
29
        global.turntimer = 70;
30
    if (swordcount > maxswords && variant == 1)
31
        global.turntimer = 120;
32
    if (swordcount > 7 && swordcount < maxswords)
33
        swordcount = 0;
34
    setcount++;
35
    if (setdirection[setcount] != -1)
36
        inst.direction = setdirection[setcount];
37
    if (multiswordmax > 0)
38
        multiswordcount++;
39
    if (multiswordcon == 0 && multiswordmax > 0)
40
        multiswordcon = 1;
41
    if (multiswordcon == 1 && multiswordcount == multiswordmax)
42
    {
43
        multiswordcon = 0;
44
        multiswordcount = 0;
45
    }
46
    with (inst)
47
    {
48
        x = obj_heart.x + 10 + lengthdir_x(len, direction);
49
        y = obj_heart.y + 10 + lengthdir_y(len, direction);
50
        ystart = y;
51
        image_angle = direction + 180;
52
    }
53
    rate -= ratedecay;
54
    if (rate < rateminimum)
55
        rate = rateminimum;
56
    timer = 0;
57
}