Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shootout_window_Other_13

(view raw script w/o annotations or w/e)
1
char_timer++;
2
switch (char_state)
3
{
4
    case "init":
5
        char_timer = 0;
6
        char_alpha = 0;
7
        char_state = "idle";
8
        can_shoot = true;
9
        char_sprite = 3756;
10
        dog_item = 4507;
11
        char_imgindex = 0;
12
        break;
13
    case "idle":
14
        char_alpha = 1;
15
        char_sprite = 3756;
16
        char_imgindex = 0;
17
        char_x = sin((char_timer / 4) * speedfactor) * -6;
18
        char_y = sin((char_timer / 8) * speedfactor) * 2;
19
        if (timer >= duration)
20
        {
21
            char_state = "outro";
22
            char_timer = -1;
23
        }
24
        break;
25
    case "hit":
26
        char_x = 0;
27
        char_y = 0;
28
        if (char_timer == 0)
29
        {
30
            char_alpha = 1;
31
            char_sprite = 3756;
32
            char_imgindex = 0;
33
            show_hit_spike = true;
34
            snd_play(snd_bluh);
35
            var _item = instance_create_depth(x, y, depth - 1, obj_shootout_dog_item);
36
            _item.rotspd = -25;
37
            _item.fadespd = 0.1;
38
            _item.image_alpha = 2;
39
            _item.image_xscale = 2;
40
            _item.image_yscale = 2;
41
            _item.sprite_index = dog_item;
42
            _item.direction = 60 + irandom(20);
43
            _item.speed = 10;
44
            _item.gravity = 1;
45
            dog_item = -1;
46
            var _points_txt = instance_create_depth(x, y - 30, obj_shootout_controller.depth - 1, obj_shootout_text);
47
            _points_txt.color = c_yellow;
48
            _points_txt.text = "+200";
49
            obj_shootout_controller.points += 200;
50
        }
51
        if (char_timer > 15)
52
            show_hit_spike = false;
53
        if (char_timer >= 30)
54
        {
55
            char_state = "outro";
56
            char_timer = -1;
57
        }
58
        break;
59
    case "outro":
60
        char_sprite = 3756;
61
        char_alpha = 
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; }
(char_alpha, 0, 0.1 * speedfactor);
62
        char_x = lerp(30, 0, char_alpha);
63
        char_y = 0;
64
        if (char_alpha < 0.5 && state != "closing")
65
        {
66
            state = "closing";
67
            timer = 0;
68
        }
69
        break;
70
}
71
char_x += sprite_xoffset;
72
char_y += sprite_yoffset;
73
draw_sprite_ext(char_sprite, char_imgindex, char_x, char_y, 2, 2, 0, c_white, char_alpha);
74
if (dog_item != -1)
75
    draw_sprite_ext(dog_item, 0, char_x, char_y - 6, 2, 2, sin(char_timer / 4) * -15, c_white, char_alpha);