Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_church_old_man_ripple_backup_Draw_0

(view raw script w/o annotations or w/e)
1
var go = false;
2
if (keyboard_check_pressed(vk_numpad5))
3
{
4
    type = 0;
5
    go = true;
6
}
7
else if (keyboard_check_pressed(vk_numpad6))
8
{
9
    type = 1;
10
    go = true;
11
}
12
if (go)
13
{
14
    active = true;
15
    if (type == 1)
16
        con = 1;
17
    else
18
        con = 0;
19
    con_timer = 0;
20
    deltatime = 1;
21
    timer = 0;
22
    susie_con = 0;
23
    susie_timer = 0;
24
}
25
if (type == 1)
26
{
27
    con_timer++;
28
    var _inc = false;
29
    if (con == 0 && con_timer >= 15)
30
    {
31
        _inc = true;
32
    }
33
    else if (con == 1 && con_timer >= 3)
34
    {
35
        deltatime = 0.25;
36
        snd_stop(motor_swing_down);
37
        snd_play_pitch(motor_swing_down, 1.4);
38
        _inc = true;
39
    }
40
    else if (con == 2 && con_timer >= 7)
41
    {
42
        deltatime = 0.15;
43
        _inc = true;
44
    }
45
    else if (con == 3 && con_timer >= 45)
46
    {
47
        snd_play(snd_heavyswing);
48
        _inc = true;
49
    }
50
    else if (con == 4 && con_timer >= 10)
51
    {
52
        wind_sfx = snd_play(snd_strongwind_loop);
53
        snd_volume(wind_sfx, 0, 60);
54
        deltatime = 3;
55
        _inc = true;
56
    }
57
    if (_inc)
58
    {
59
        con++;
60
        con_timer = 0;
61
    }
62
}
63
var _ripplecount = ripplecount;
64
if (type == 1)
65
    _ripplecount += 4;
66
else
67
    _ripplecount += 2;
68
if (active)
69
{
70
    draw_set_color(color);
71
    var _itv = 0;
72
    var _max_radius = (type == 1) ? 500 : 350;
73
    var _life = 40;
74
    var _pow = 2;
75
    var _thickness = (type == 1) ? 1 : 1;
76
    var _ringcount = 0;
77
    for (var i = 0; i < _ripplecount; i++)
78
    {
79
        if (timer < (i * _itv))
80
            break;
81
        _ringcount++;
82
        var _radius = 
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; } }
(clamp01(inverselerp(i * _itv, (i * _itv) + _life + (i * 30), timer)), 4) * _max_radius;
83
        var _col = merge_color(color, c_black, clamp01(((_radius / _max_radius) * 8) - 7));
84
        draw_set_color(_col);
85
        var _oradius = _radius;
86
        d_circle(x, y, _radius, false);
87
        if ((timer - 2) < (i * _itv))
88
            break;
89
        draw_set_color(c_black);
90
        if (type == 0)
91
            _radius = _radius - 6;
92
        else
93
            _radius = min(
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; } }
(clamp01(inverselerp(i * _itv, (i * _itv) + _life + (i * 30), timer - _thickness)), 4) * (_max_radius - 1), _radius - 6);
94
        if (type == 2)
95
            d_circle(x + (_radius / 20), y, _oradius - _delay, false);
96
        else
97
            d_circle(x, y, _radius, false);
98
    }
99
    timer += deltatime;
100
    if ((timer - _thickness) >= ((_itv * _ripplecount) + (_life * _ripplecount)))
101
    {
102
        timer = 0;
103
        active = false;
104
    }
105
}
106
if (timer > 0 || con > 2)
107
{
108
    var _xx = x - 50;
109
    var _yy = y - 60;
110
    var _image = 0;
111
    var _shadow_col = 0;
112
    if (con < 2)
113
    {
114
        draw_sprite_ext(sprite[con], _image, _xx, _yy, 2, 2, image_angle, c_black, 1);
115
        dust_timer = 0;
116
    }
117
    if (con == 2 || (con == 3 && dust_timer < 7))
118
    {
119
        draw_sprite_ext(spr_gerson_shadow_leap, dust_timer, _xx, _yy, 2, 2, image_angle, _shadow_col, 1);
120
        if (dust_timer < 2)
121
            dust_timer++;
122
        else
123
            dust_timer += 0.2;
124
    }
125
    if (con == 3)
126
    {
127
        var _move = con_timer / 40;
128
        _image = (con_timer < 20) ? 1 : 0;
129
        if (con_timer == 30)
130
            susie_con = 1;
131
        if (con_timer == 43)
132
            susie_con = 2;
133
        draw_sprite_ext(spr_gerson_swing, _image, _xx - 200 - (_move * 8), _yy - 20 - (_move * 6), 2, 2, image_angle, _shadow_col, 1);
134
    }
135
    else if (con >= 4)
136
    {
137
        var _move = con_timer / 60;
138
        if (con == 5)
139
            _move = con_timer / 30;
140
        _image = (con == 5) ? 6 : min(con_timer + 4, 6);
141
        draw_sprite_ext(spr_gerson_swing, _image, _xx - 208 - (_move * 8), (_yy - 26) + (_move * 6), 2, 2, image_angle, _shadow_col, 1);
142
    }
143
    if (con < 2)
144
    {
145
        var _alpha = 1;
146
        if (timer <= 4)
147
            _alpha = timer / 4;
148
        else
149
            _alpha = clamp01(inverselerp(60, 10, timer));
150
        draw_sprite_ext(spr_gerson_battle_overworld_underlight, 0, x - 50, y - 60, 2, 2, image_angle, color, _alpha);
151
    }
152
    var _susx = x - 300;
153
    var _susy = y - 60;
154
    if (susie_con == 0)
155
        draw_sprite_ext(spr_susie_right_dw, 0, _susx, _susy, 2, 2, 0, c_black, 1);
156
    if (susie_con == 1)
157
        draw_sprite_ext(spr_susie_actready, 0, _susx, _susy, 2, 2, 0, c_black, 1);
158
    if (susie_con == 2)
159
    {
160
        if (susie_timer < 30)
161
            susie_timer++;
162
        _susx -= (
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; } }
(susie_timer / 30, 4) * 50);
163
        draw_sprite_ext(spr_susie_shock_r, 0, _susx, _susy, 2, 2, 0, c_black, 1);
164
    }
165
}
166
draw_set_blend_mode(bm_normal);
167
draw_set_alpha(1);
168
draw_set_color(c_white);