Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_sword_vortex_manager_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
siner++;
3
if ((timer == rate && swordcount < maxswords) || (timer == multiswordframes && multiswordcon == 1))
4
{
5
    inst = instance_create(obj_growtangle.x, obj_growtangle.y, obj_sword_vortex);
6
    inst.dir = choose(0, 45, 90, 135, 180, 225, 270, 315);
7
    inst.variant = variant;
8
    inst.sinpower = sinpower;
9
    inst.sinspeed = sinspeed;
10
    inst.len = startinglen;
11
    inst.lenstart = inst.len;
12
    inst.shrinkrate = shrinkrate;
13
    inst.damage = damage;
14
    inst.target = target;
15
    swordcount++;
16
    setcount++;
17
    if (setdirection[setcount] != -1)
18
        inst.dir = setdirection[setcount];
19
    if (multiswordmax > 0)
20
        multiswordcount++;
21
    if (multiswordcon == 0 && multiswordmax > 0)
22
        multiswordcon = 1;
23
    if (multiswordcon == 1 && multiswordcount == multiswordmax)
24
    {
25
        multiswordcon = 0;
26
        multiswordcount = 0;
27
    }
28
    with (inst)
29
    {
30
        x = xstart + lengthdir_x(len, dir);
31
        y = ystart + lengthdir_y(len, dir);
32
        image_angle = dir - 90;
33
    }
34
    rate -= ratedecay;
35
    if (rate < rateminimum)
36
        rate = rateminimum;
37
    timer = 0;
38
}
39
if (centermoves == 1)
40
{
41
    if (centermovescon == 0)
42
    {
43
        startx = swordcirclecenterx;
44
        starty = swordcirclecentery;
45
        targetx = (obj_growtangle.x - 60) + irandom(120);
46
        targety = (obj_growtangle.y - 60) + irandom(120);
47
        centermovescon = 1;
48
    }
49
    if (centermovescon == 1)
50
    {
51
        centermovestimer++;
52
        swordcirclecenterx = lerp(startx, targetx, centermovestimer / movespeed);
53
        swordcirclecentery = lerp(starty, targety, centermovestimer / movespeed);
54
        if (centermovestimer == movespeed)
55
        {
56
            centermovestimer = 0;
57
            centermovescon = 0;
58
        }
59
    }
60
}