Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_roaringknight_quickslash_afterimage_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
if (!init)
3
{
4
    image_alpha = 1;
5
    xdir = lengthdir_x(250, image_angle);
6
    ydir = lengthdir_y(250, image_angle);
7
    init = true;
8
}
9
if (!slash)
10
{
11
    if (timer <= 6)
12
    {
13
        xdraw = xdir * (1 - (timer / 6));
14
        ydraw = ydir * (1 - (timer / 6));
15
        if (flip)
16
        {
17
            xdraw *= -1;
18
            ydraw *= -1;
19
        }
20
    }
21
    thickness = lerp(3, 1, 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(inverselerp(0, 30, timer), 6));
22
    trailthickness = thickness + 2;
23
    if (timer > 10)
24
        image_blend = merge_color(c_gray, c_red, (timer - 10) / 20);
25
}
26
if (timer == 30)
27
{
28
    image_blend = c_white;
29
    active = true;
30
    slash = true;
31
    sprite_index = spr_rk_quickslash;
32
    image_speed = 1;
33
    image_index = 0;
34
    snd_play_pitch(snd_knight_cut2, random_range(0.95, 1.05));
35
    with (obj_roaringknight_quickslash_attack)
36
    {
37
        if (other.flip)
38
            event_user(2);
39
        else
40
            event_user(1);
41
    }
42
}
43
if (timer == 32)
44
    active = false;