Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_ch3_b4_chef_kris_Step_0

(view raw script w/o annotations or w/e)
1
if (obj_ch3_b4_chef_controller.gameover)
2
    exit;
3
if (firewait > 0)
4
{
5
    firewait--;
6
    if (firewait <= 0)
7
        invincible = 60;
8
}
9
if (invincible > 0)
10
{
11
    invincible--;
12
    if (image_alpha == 0.3)
13
        image_alpha = 1;
14
    else
15
        image_alpha = 0.3;
16
}
17
else
18
{
19
    image_alpha = 1;
20
}
21
var _x = clamp(x, xstart - 128, xstart + 128);
22
if (x != _x)
23
{
24
    x = _x;
25
    hspeed = 0;
26
}
27
if (obj_ch3_b4_chef_controller.gameover)
28
{
29
    image_speed = 0;
30
    gravity = 0;
31
    speed = 0;
32
    y = yprevious;
33
    x = xprevious;
34
    image_alpha = 1;
35
    exit;
36
}
37
var _h = 0;
38
var _cap = max(4, stack_height) + 3;
39
if (jumping == 0)
40
{
41
    if (left_h())
42
        _h = -1;
43
    if (right_h())
44
        _h = 1;
45
    if (throwing || firewait > 0 || stun > 0)
46
        _h = 0;
47
    var _maxspd = 8;
48
    var _spd = _h * ((_cap - stack_height) / _cap) * _maxspd;
49
    var _acc = (((_cap - stack_height) / _cap) * (_maxspd / 3)) + (_maxspd / 3);
50
    hspeed = clamp_gradual(hspeed, _spd, _spd, _acc);
51
    if (!throwing)
52
    {
53
        if (round(hspeed) == 0)
54
        {
55
            sprite_index = spr_kris_chef;
56
        }
57
        else
58
        {
59
            image_speed = _h * ((_cap - stack_height) / _cap);
60
            sprite_index = spr_kris_chef_walk;
61
        }
62
    }
63
    if (button2_p() && !throwing && !(firewait > 0 || stun > 0))
64
    {
65
        jumping = 1;
66
        jumphspeed = hspeed;
67
        hspeed = 0;
68
        jumpwait = 1 + stack_height;
69
    }
70
}
71
if (jumping == 1)
72
{
73
    jumpwait--;
74
    if (!throwing)
75
        sprite_index = spr_kris_chef_squat;
76
    if (jumpwait <= 0)
77
    {
78
        hspeed = jumphspeed;
79
        snd_play(snd_jump);
80
        gravity_direction = 270;
81
        gravity = 1;
82
        vspeed = -12 + ((stack_height / _cap) * 5);
83
        hspeed = clamp(hspeed, -4, 4);
84
        jumping = 2;
85
        jump_spinspd = 0.5 + (0.5 * ((10 - min(stack_height, 10)) / 10));
86
        if (hspeed != 0)
87
            jump_spinspd *= sign(hspeed);
88
    }
89
}
90
if (jumping == 2 && !throwing)
91
{
92
    image_speed = jump_spinspd;
93
    sprite_index = spr_krisb_pirouette_plate;
94
}
95
if ((jumping == 2 || stun > 0) && y >= (ystart - abs(vspeed)) && vspeed > 0)
96
{
97
    jumping = false;
98
    gravity = 0;
99
    y = ystart;
100
    vspeed = 0;
101
}
102
if (stun > 0)
103
{
104
    stun--;
105
    image_speed = 0;
106
    sprite_index = spr_chefs_kris_stun;
107
    if (y < ystart)
108
    {
109
        image_index = 0;
110
    }
111
    else
112
    {
113
        y = ystart;
114
        image_index = 1;
115
        vspeed = 0;
116
    }
117
}