Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_door_Draw_0

(view raw script w/o annotations or w/e)
1
var _left_door = 0;
2
var _bg_col = merge_colour(c_navy, c_dkgray, 0.5);
3
var right_offset = -22;
4
var bottom_offset = -48;
5
draw_set_colour(_bg_col);
6
if (act > 0)
7
    draw_set_colour(c_black);
8
ossafe_fill_rectangle(x, y, x + 159 + right_offset, y + 159 + bottom_offset, 0);
9
draw_set_colour(_bg_col);
10
if (act > 0)
11
    draw_set_colour(c_black);
12
ossafe_fill_rectangle(x + 1, y + 1, x + 78 + right_offset, y + 60 + bottom_offset, 0);
13
ossafe_fill_rectangle(x + 82, y + 1, x + 158 + right_offset, y + 60 + bottom_offset, 0);
14
if (act == 0)
15
{
16
    var v = 0;
17
    if (i_ex(obj_mike_controller) && 
scr_onscreen
scr_onscreen

function
scr_onscreen(arg0)
{ obj = arg0; spacer = 0; if ((obj.x + obj.sprite_width + spacer) < camerax() || (obj.x - spacer) > (camerax() + 640) || (obj.y + obj.sprite_height + spacer) < cameray() || (obj.y - spacer) > (cameray() + 480)) return false; else return true; }
(id) && global.interact == 0)
18
        v = (obj_mike_controller.microphone_volume2 / 100) * 169;
19
    if (_left_door == 0)
20
    {
21
        var _mix = clamp(0.5 + (sin(current_time / 100) * 0.5), 0, 1);
22
        draw_set_colour(merge_colour(c_red, c_white, _mix));
23
        if (v > 70)
24
            ossafe_fill_rectangle(x, ((y + 79) - clamp(v - 90, 0, 15)) + bottom_offset, x + 159 + right_offset, y + 99 + bottom_offset, 0);
25
        draw_set_colour(merge_colour(c_yellow, c_white, _mix));
26
        if (v > 30)
27
            ossafe_fill_rectangle(x, ((y + 139) - clamp(v - 30, 0, 40)) + bottom_offset, x + 159 + right_offset, y + 139 + bottom_offset, 0);
28
        draw_set_colour(merge_colour(c_lime, c_white, _mix));
29
        if (v > 1)
30
            ossafe_fill_rectangle(x, ((y + 159) - clamp(v, 0, 30)) + bottom_offset, x + 159 + right_offset, y + 159 + bottom_offset, 0);
31
    }
32
    draw_sprite_ext(sprite_index, _left_door, x, y, image_xscale, 2, 0, c_white, 1);
33
    draw_sprite_ext(sprite_index, 1, x + 2, y, image_xscale, 2, 0, c_white, 1);
34
    if (charge > 0)
35
    {
36
    }
37
    if (v >= 100 && _left_door == 0)
38
    {
39
        if (rumble == 0)
40
        {
41
            rumble = snd_loop(snd_rumble);
42
            snd_volume(rumble, 0, 0);
43
        }
44
        else
45
        {
46
            snd_volume(rumble, charge, 0);
47
            mus_volume(global.currentsong[1], 1 - charge, 0);
48
        }
49
        charge = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(charge, 1, 0.1);
50
    }
51
    else
52
    {
53
        charge = 0;
54
        if (rumble != 0)
55
        {
56
            snd_stop(rumble);
57
            rumble = 0;
58
            mus_volume(global.currentsong[1], 1, 0);
59
        }
60
    }
61
    if (charge == 1)
62
    {
63
        snd_stop(rumble);
64
        rumble = 0;
65
        mus_volume(global.currentsong[1], 1, 0);
66
        act = 1;
67
        snd_play(snd_boost);
68
        
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
(id, 4, 0.1);
69
        global.flag[1697] = 1;
70
        with (obj_doorAny)
71
            y = ystart;
72
        alarm[0]
 = 10;
gml_Object_obj_mike_door_Alarm_0.gml

with (obj_solidblockDark) { if (x == 200 && y == 200) image_xscale = 1; }
73
        with (obj_solidblockDark)
74
        {
75
            if (x == 200 && y == 200)
76
                image_xscale = 1;
77
        }
78
    }
79
}
80
if (act == 1)
81
{
82
    timer += 1;
83
    if (timer > 45)
84
        xscale = lerp(xscale, 0, 0.2);
85
    var _col = _bg_col;
86
    if ((current_time % 300) > 150 || xscale < 1 || timer > 20)
87
        _col = 16777215;
88
    draw_sprite_ext(sprite_index, 2, round(x), round(y), image_xscale * xscale, 2, 0, _col, 1);
89
    draw_sprite_ext(sprite_index, 3, round(x) + 2 + ((2 * (1 - xscale) * sprite_width) / 2), round(y), image_xscale * xscale, 2, 0, _col, 1);
90
    if (console_version)
91
    {
92
        if (global.interact == 0 && lastinteract == 5)
93
        {
94
            if (global.input_g[4] == gp_shoulderrb && !obj_gamecontroller.gamepad_shoulderlb_reassign)
95
            {
96
                with (obj_mike_door)
97
                {
98
                    if (act == 1)
99
                    {
100
                        act = 0;
101
                        timer = 0;
102
                        xscale = 1;
103
                        snd_play(snd_locker);
104
                        with (obj_doorAny)
105
                        {
106
                            if (y < 300)
107
                                y = -1000;
108
                        }
109
                        with (obj_solidblockDark)
110
                        {
111
                            if (x == 200 && y == 200)
112
                                image_xscale = 5;
113
                        }
114
                        with (obj_mainchara)
115
                        {
116
                            if (bbox_right >= 200 && bbox_left <= 400 && bbox_top <= 240)
117
                                y += (240 - bbox_top);
118
                        }
119
                        
scr_shakescreen
scr_shakescreen

function
scr_shakescreen(arg0 = 4, arg1 = 4)
{ var shaker = instance_create(x, y, obj_shake); if (i_ex(shaker)) { shaker.shakex = arg0; shaker.shakey = arg1; } }
(0, 4);
120
                    }
121
                }
122
            }
123
        }
124
    }
125
}
126
lastinteract = global.interact;
127
if (instance_number(obj_mike_controller) > 0 && instance_number(obj_micmenu) == 0)
128
{
129
    with (obj_mike_controller)
130
        microphone_volume2 += ((microphone_volume - microphone_volume2) * 0.25);
131
}