Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_dw_tv_funometer_old_Draw_0

(view raw script w/o annotations or w/e)
1
functionalfun = lerp(functionalfun, fun, funspeed);
2
functionalfun = clamp01(functionalfun);
3
if (!hope)
4
    draw_sprite_ext(sprite_index, 1, x, y, 2, 2, image_angle, image_blend, image_alpha);
5
else
6
    draw_sprite_ext(spr_dw_tv_funometer_hope, 1, x, y, 2, 2, image_angle, image_blend, image_alpha);
7
var intensity = 
scr_inverselerp
scr_inverselerp

function inverselerp(arg0, arg1, arg2) { if (arg1 == arg0) return 0; return (arg2 - arg0) / (arg1 - arg0); } function
scr_inverselerp(arg0, arg1, arg2)
{ if (arg1 == arg0) return 0; return (arg2 - arg0) / (arg1 - arg0); }
(empty, full, functionalfun);
8
intensity = clamp01(intensity);
9
var amount = (sprite_height / 2) * (1 - functionalfun);
10
var maxamount = (sprite_height / 2) * full;
11
var _sine = sin(siner / 10);
12
var _siner = sin(siner / 15);
13
amount += (_sine * (intensity * 2));
14
if (amount > maxamount)
15
    amount += (amount - maxamount);
16
var meter_color = 255;
17
if (intensity <= 0.2)
18
    meter_color = merge_color(c_blue, c_red, remap_clamped(0.08, 0.2, 0, 1, intensity));
19
if (intensity >= 0.9)
20
    meter_color = merge_color(c_red, c_yellow, remap_clamped(0.9, 1, 0, 0.75, (intensity + (_siner * 0.05)) - 0.025));
21
draw_sprite_part_ext_rot(sprite_index, 2, 0, amount, sprite_width, sprite_height, x, y, image_xscale, image_yscale, image_angle, meter_color, image_alpha);
22
if (
scr_debug
scr_debug

function
scr_debug()
{ if (global.debug == 1) return 1; }
())
23
{
24
    if (keyboard_check(ord("1")))
25
        fun = empty;
26
    if (keyboard_check(ord("2")))
27
        fun = half;
28
    if (keyboard_check(ord("3")))
29
        fun = full;
30
}
31
if (intensity >= 0.9)
32
{
33
    if (shakecon <= 0)
34
    {
35
        xstart = x;
36
        ystart = y;
37
        shakecon = 1;
38
    }
39
    var _force = remap_clamped(0.9, 1, 0, 1, intensity);
40
    var _dir = random_range(-180, 180);
41
    var _len = random_range(0, 2) * _force;
42
    var _v2 = 
scr_get_sprite_point
scr_get_sprite_point

function
scr_get_sprite_point(arg0 = -4, arg1 = 0.5, arg2 = 0.5, arg3 = true)
{ var __v2 = new Vector2(0, 0); if (arg0 != -4) { with (arg0) { __v2.x = (x - sprite_xoffset) + (sprite_width * arg1); __v2.y = (y - sprite_yoffset) + (sprite_height * arg2); if (arg3) __v2 = scr_rotatevector_around(__v2, new Vector2(x, y), image_angle); } } return __v2; } function scr_get_sprite_point_x(arg0, arg1 = 0.5, arg2 = true) { return
scr_get_sprite_point(arg0, arg1, 0.5, arg2).x;
} function scr_get_sprite_point_y(arg0, arg1 = 0.5, arg2 = true) { return
scr_get_sprite_point(arg0, 0.5, arg1, arg2).y;
}
(id);
43
    x = xstart;
44
    y = ystart;
45
    direction = 0;
46
    
scr_rotatearoundpoint
scr_rotatearoundpoint

function
scr_rotatearoundpoint(arg0, arg1, arg2)
{
scr_orbitaroundpoint(arg0, arg1, arg2);
direction += arg2; }
(_v2.x, _v2.y, random_range(-2, 2) * _force);
47
    image_angle = direction;
48
    x += lengthdir_x(_len, _dir);
49
    y += lengthdir_y(_len, _dir);
50
}
51
if (intensity < 0.9 && shakecon > 0)
52
{
53
    x = xstart;
54
    y = ystart;
55
    shakecon = 0;
56
}
57
siner += sqr(intensity * 4);