Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_chefs_kris_Create_0

(view raw script w/o annotations or w/e)
1
pos = 0;
2
pos_range = 0;
3
jumping = 0;
4
jumpwait = 0;
5
image_xscale = 2;
6
image_yscale = 2;
7
depth = 20;
8
invincible = 0;
9
firewait = 0;
10
xstart = 320;
11
ystart = 280;
12
x = xstart;
13
y = ystart;
14
pointsprev = 0;
15
stun = 0;
16
stack_height = 0;
17
18
function add_to_stack(arg0)
19
{
20
    arg0.caught = true;
21
    arg0.falling = false;
22
    food[stack_height] = arg0;
23
    stack_height++;
24
    if (jumping >= 2)
25
    {
26
        snd_play_pitch(snd_egg, 1.5);
27
        instance_create(x, y, obj_chefs_jumpcatchtxt);
28
        obj_chefs_game.scorepoints++;
29
    }
30
    else
31
    {
32
        snd_play_pitch(snd_egg, 1.3);
33
    }
34
}
35
36
t = 0;
37
38
function burn_stack()
39
{
40
    var _fall = true;
41
    if (stack_height <= 0)
42
    {
43
        if (invincible || stun > 0)
44
            exit;
45
    }
46
    for (var i = 0; i < stack_height; i++)
47
    {
48
        with (food[i])
49
        {
50
            gravity = 0.8;
51
            direction = 80 + irandom(20);
52
            speed = 6;
53
            on_fire = true;
54
        }
55
        obj_chefs_game.scorepoints--;
56
    }
57
    obj_chefs_game.scorepoints = clamp(obj_chefs_game.scorepoints - 3, 0, abs(obj_chefs_game.scorepoints));
58
    if (abs(obj_chefs_game.scorepoints - pointsprev) > 0 && !i_ex(obj_tenna_enemy))
59
    {
60
        with (obj_chefs_scoretxt)
61
            instance_destroy();
62
        var _text = instance_create_depth(x, y, depth - 10, obj_chefs_scoretxt);
63
        _text.blurb = "-" + string(abs(obj_chefs_game.scorepoints - pointsprev));
64
        _text.red = true;
65
    }
66
    if (stack_height > 0)
67
    {
68
        stack_height = 0;
69
        array_delete(food, 0, array_length(food));
70
    }
71
    snd_play_pitch(snd_error, 1.2);
72
    snd_play_pitch(snd_explosion_mmx, 0.8);
73
    if (obj_chefs_game.microgame == 1)
74
        _fall = 0;
75
    if (i_ex(obj_tenna_enemy))
76
    {
77
        if (i_ex(obj_tenna_enemy))
78
        {
79
            global.inv = -1;
80
            obj_tenna_enemy.minigamefailcount++;
81
            if (obj_tenna_enemy.minigamefailcount == 3 && obj_tenna_zoom.con != 2 && obj_tenna_zoom.minigameinsanity == false)
82
            {
83
                with (obj_tenna_zoom)
84
                {
85
                    con = 2;
86
                    timer = -1;
87
                }
88
            }
89
        }
90
    }
91
    if (_fall)
92
    {
93
        firewait = 40;
94
        stun = 40;
95
        hspeed = 0;
96
        vspeed = -8;
97
        gravity = 1;
98
        y -= 2;
99
        image_speed = 0;
100
        sprite_index = spr_chefs_kris_stun;
101
        image_index = 0;
102
        jumping = 0;
103
        throwing = 0;
104
    }
105
    else
106
    {
107
        firewait = 10;
108
        invincible = 45;
109
    }
110
}
111
112
throwing = 0;
113
throwwait = 0;
114
115
function throw_food()
116
{
117
    if (throwing > 0)
118
        exit;
119
    if (stack_height <= 0)
120
        exit;
121
    throwing = 1;
122
    sprite_index = spr_krisb_throwplate;
123
    image_index = 0;
124
    image_speed = 0;
125
    throwwait = 3 + clamp(stack_height - 2, 0, 10);
126
    if (stack_height >= 6)
127
        snd_play_pitch(snd_noise, 1.2);
128
}
129
130
if (i_ex(obj_chefs_init))
131
    depth = obj_chefs_init.depth - 10;