Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shootout_window_Other_11

(view raw script w/o annotations or w/e)
1
char_timer++;
2
var _extratime;
3
switch (char_state)
4
{
5
    case "init":
6
        char_timer = -1;
7
        char_alpha = 0;
8
        char_state = "idle";
9
        can_shoot = true;
10
        char_sprite = 3818;
11
        if (obj_shootout_controller.shootout_type > 1)
12
            char_sprite = 1420;
13
        char_imgindex = 0;
14
        char_y = 40;
15
        char_x = 5;
16
        break;
17
    case "idle":
18
        if (char_timer == 0)
19
        {
20
            char_sprite = 3818;
21
            if (obj_shootout_controller.shootout_type > 1)
22
                char_sprite = 1420;
23
            char_imgindex = 0;
24
            char_alpha = 1;
25
        }
26
        char_x = 0;
27
        hit = 0;
28
        if (char_y > -10 && char_sprite != 557)
29
        {
30
            char_y -= 10;
31
            if (char_y == 0)
32
                windowshaketimer = 10;
33
            if (char_y < -8)
34
                char_y = -8;
35
        }
36
        if (can_shoot)
37
        {
38
            if (char_timer > ((idle_duration / 5) - 6))
39
            {
40
                if (image_index < 3)
41
                    image_index += (1/3);
42
                if (image_index == 1)
43
                    snd_play_x(snd_board_throw, 0.5, 1.3 + random_range(-0.1, 0.3));
44
            }
45
            if (char_timer > (idle_duration / 3))
46
            {
47
                char_sprite = 557;
48
                if (obj_shootout_controller.shootout_type > 1)
49
                    char_sprite = 1420;
50
            }
51
            _extratime = 0;
52
            if (obj_shootout_controller.tutorialmode)
53
                _extratime = 120;
54
            if (obj_shootout_controller.tutorialmode && obj_shootout_controller.tutorialorder == 1)
55
                _extratime = 99999;
56
            if (difficulty_extratime != 0)
57
                _extratime = difficulty_extratime;
58
            if (char_timer >= (idle_duration + _extratime))
59
            {
60
                char_state = "aim";
61
                char_timer = -1;
62
            }
63
        }
64
        if (i_ex(obj_tenna_enemy_minigametext))
65
        {
66
            char_state = "outro";
67
            char_timer = -1;
68
        }
69
        break;
70
    case "aim":
71
        var _aim_duration = floor(12 - (speedfactor * 2));
72
        char_alpha = 1;
73
        char_x = 0;
74
        if (char_timer > (_aim_duration / 2))
75
        {
76
            char_sprite = 3425;
77
            if (obj_shootout_controller.shootout_type > 1)
78
                char_sprite = 1420;
79
        }
80
        if (char_timer >= _aim_duration)
81
        {
82
            char_state = "shoot";
83
            char_timer = -1;
84
        }
85
        break;
86
    case "shoot":
87
        if (char_timer == 0)
88
        {
89
            char_alpha = 1;
90
            can_shoot = false;
91
            char_sprite = 1105;
92
            if (obj_shootout_controller.shootout_type > 1)
93
                char_sprite = 532;
94
            char_imgindex = 0;
95
            with (obj_shootout_controller)
96
                krishit = true;
97
            var gunx = x - 60;
98
            var guny = y + 60;
99
            var shot = instance_create_depth(gunx, guny, -9999, obj_shootout_vfx_mockup_shot);
100
            shot.enemy = 1;
101
            shot.targetx = camerax() + 120;
102
            shot.targety = cameray() + 310;
103
            shot.sprite_index = spr_smallbullet;
104
            var impactfx = instance_create(gunx, guny, obj_animation);
105
            impactfx.sprite_index = spr_attack_slap2;
106
            impactfx.image_speed = 2;
107
            impactfx.image_xscale = 1;
108
            impactfx.image_yscale = 1;
109
            impactfx.image_blend = c_white;
110
            impactfx.depth = depth - 10;
111
            impactfx = instance_create(gunx, guny, obj_animation);
112
            impactfx.sprite_index = spr_attack_slap2;
113
            impactfx.image_speed = 1;
114
            impactfx.image_xscale = 1;
115
            impactfx.image_yscale = 1;
116
            impactfx.image_blend = c_red;
117
            impactfx.depth = depth - 10;
118
            for (var i = 0; i < 8; i++)
119
            {
120
                var smokefx = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(gunx, guny, spr_slidedust);
121
                smokefx.hspeed = random_range(-2, 8);
122
                smokefx.gravity_direction = 180;
123
                smokefx.gravity = 2 - random(0.4);
124
                smokefx.image_speed = 0.2;
125
                smokefx.image_xscale = 2 + random(1);
126
                smokefx.image_yscale = 2 + random(1);
127
                smokefx.vspeed = random_range(-4, 0);
128
                scr_lerp_var_instance(smokefx, "image_alpha", 0.6, 0, 12);
129
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(smokefx, 12);
130
            }
131
        }
132
        var _shoot_duration = floor(30 - (speedfactor * 7));
133
        var _bullet_delay = 5;
134
        if (char_timer >= _shoot_duration)
135
        {
136
            char_state = "outro";
137
            char_timer = -1;
138
            char_y = -8;
139
        }
140
        break;
141
    case "hit":
142
        char_x = 0;
143
        char_y = 0;
144
        if (char_timer == 0)
145
        {
146
            char_alpha = 1;
147
            char_sprite = 601;
148
            if (obj_shootout_controller.shootout_type > 1)
149
                char_sprite = 4842;
150
            char_imgindex = 0;
151
            show_hit_spike = true;
152
            if (i_ex(obj_tenna_enemy))
153
            {
154
            }
155
            else
156
            {
157
                var _points_txt = instance_create_depth(x, y - 30, obj_shootout_controller.depth - 1, obj_shootout_text);
158
                _points_txt.color = c_yellow;
159
                _points_txt.text = "+1";
160
                with (obj_dw_points_fake_ui)
161
                    instance_destroy();
162
                points_display = instance_create(0, 0, obj_dw_points_fake_ui);
163
                with (points_display)
164
                {
165
                    xx -= 560;
166
                    yy -= 160;
167
                    alarm[0]
 = 60;
gml_Object_obj_shootout_window_Alarm_0.gml

exit;
168
                }
169
                with (points_display)
170
                    display_points(1);
171
                with (points_display)
172
                    show_point_increase();
173
            }
174
            obj_shootout_controller.hitcount++;
175
            if (obj_shootout_controller.tutorialmode == true && obj_shootout_controller.hitcount == 3)
176
                obj_shootout_controller.windowdelay = 34;
177
            obj_shootout_controller.points += 100;
178
        }
179
        if (char_timer >= 10)
180
            show_hit_spike = false;
181
        if (char_timer >= 15)
182
        {
183
            char_state = "outro";
184
            char_timer = -1;
185
            char_y = -8;
186
        }
187
        break;
188
    case "outro":
189
        timerb++;
190
        if (timerb > 8)
191
        {
192
            char_sprite = 3818;
193
            if (obj_shootout_controller.shootout_type > 1)
194
                char_sprite = 1420;
195
            if (image_index > 0.4)
196
                image_index -= (1/3);
197
            else
198
                image_index = 0;
199
        }
200
        if (timerb == 13)
201
            char_y -= 2;
202
        if (timerb == 14)
203
            char_y -= 4;
204
        if (timerb > 14)
205
            char_y += 10;
206
        if (char_y > 50)
207
        {
208
            state = "closing";
209
            timer = 0;
210
            timerb = 0;
211
        }
212
    case "closing":
213
        break;
214
}
215
if (char_sprite == 601 && char_imgindex < 8)
216
    char_imgindex += 0.5;
217
if (char_sprite == 1105 && char_imgindex < 2)
218
    char_imgindex += 0.25;
219
if (char_sprite == 557 && char_imgindex < 4)
220
    char_imgindex += (1/3);
221
if (char_sprite == 557 && char_imgindex == 3)
222
    char_y += 8;
223
if (_x == 0 && (char_sprite == 557 || char_sprite == 1105 || char_sprite == 3425))
224
{
225
}
226
else
227
{
228
    var _col = 16777215;
229
    if (char_state == "idle" && char_timer > 10)
230
        _col = merge_color(c_white, c_red, clamp((char_timer - 10) / (idle_duration + _extratime), 0, 0.7));
231
    if (char_state == "aim" || char_state == "shoot")
232
        _col = 255;
233
    var _char_x = char_x + sprite_yoffset;
234
    var _char_y = char_y + sprite_yoffset;
235
    draw_sprite_ext(char_sprite, char_imgindex, _char_x + _x, _char_y + _y, 2, 2, 0, _col, 1);
236
}