Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_grabcat_pluey_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
if (wall_destroy == 1)
3
{
4
    if (x < (__view_get(e__VW.XView, 0) - 80))
5
        instance_destroy();
6
    if (x > (__view_get(e__VW.XView, 0) + 760))
7
        instance_destroy();
8
    if (y < (__view_get(e__VW.YView, 0) - 80))
9
        instance_destroy();
10
    if (y > (__view_get(e__VW.YView, 0) + 580))
11
        instance_destroy();
12
}
13
else if (!
scr_outside_camera
scr_outside_camera

function
scr_outside_camera(arg0)
{ _offcamera = 0; rightx = x + sprite_width; leftx = x; bottomy = y + sprite_height; topy = y; if (x > (__view_get(e__VW.XView, 0) + __view_get(e__VW.WView, 0) + arg0)) _offcamera = 1; if (rightx < (__view_get(e__VW.XView, 0) - arg0)) _offcamera = 1; if (y > (__view_get(e__VW.YView, 0) + __view_get(e__VW.HView, 0) + arg0)) _offcamera = 1; if (bottomy < (__view_get(e__VW.YView, 0) - arg0)) _offcamera = 1; return _offcamera; } enum e__VW { XView, YView, WView, HView, Angle, HBorder, VBorder, HSpeed, VSpeed, Object, Visible, XPort, YPort, WPort, HPort, Camera, SurfaceID }
(32) && action == 4)
14
{
15
    wall_destroy = 1;
16
}
17
depth = obj_mike_hand.depth + 1;
18
image_blend = c_aqua;
19
image_speed = abs(speed) * 0.33;
20
if (action == 0)
21
{
22
    if (israin)
23
    {
24
        sprite_index = spr_mike_cat_hold_outline;
25
        gravity = 0.2;
26
        vspeed = min(vspeed, max_vspeed);
27
        if (y >= 310)
28
        {
29
            with (
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; }
(x, y, spr_mike_raindrop_land))
30
            {
31
                image_xscale = 2;
32
                image_yscale = 2;
33
                image_speed = 0.25;
34
                image_blend = c_aqua;
35
                
scr_doom
scr_doom

function
scr_doom(arg0 = id, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; persistent = arg0.persistent; } }
(self, 7);
36
            }
37
            if (i_ex(obj_mike_minigame_controller))
38
                snd_play(snd_plueyraincat);
39
            instance_destroy();
40
        }
41
        hspeed = 0;
42
        exit;
43
    }
44
    if (idle_timer < 120)
45
        sprite_index = spr_mike_cat_walk_outline;
46
    if (walks)
47
    {
48
        if (side == 1 && x > (camerax() + camerawidth()))
49
        {
50
            side = -1;
51
            hspeed = side * irandom_range(2, 5);
52
        }
53
        if (side == -1 && x < camerax())
54
        {
55
            side = 1;
56
            hspeed = side * irandom_range(2, 5);
57
        }
58
        if (hspeed == 0)
59
            hspeed = side * irandom_range(2, 5);
60
        xscale = 
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; }
(xscale, sign(hspeed), 0.2);
61
    }
62
    else if (y < (cameray() + 310))
63
    {
64
        vspeed += 0.25;
65
    }
66
    else
67
    {
68
        hspeed = 0;
69
        vspeed = 0;
70
        if (x < anchorx)
71
            x = 
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; }
(x, anchorx, 3);
72
        else
73
            x = 
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; }
(x, anchorx, 8);
74
        if (x == anchorx)
75
        {
76
            image_speed = 0;
77
            image_xscale = 1;
78
            idle_timer++;
79
            if (idle_timer >= 120)
80
            {
81
                sprite_index = spr_mike_cat_dance_outline;
82
                image_speed = 1;
83
            }
84
        }
85
        else
86
        {
87
            sprite_index = spr_mike_cat_walk_outline;
88
            idle_timer = 0;
89
            image_speed = 2;
90
            xscale = -1 * sign(x - anchorx);
91
        }
92
    }
93
    if (instance_number(obj_mike_catbasket) == 0)
94
        action = 4;
95
}
96
if (action == 1)
97
{
98
    xscale = 1;
99
    sprite_index = spr_mike_cat_hold_outline_smallhitbox;
100
    x = obj_mike_controller.mx;
101
    y = obj_mike_controller.my + 24;
102
}
103
if (action == 2)
104
{
105
    if (speed == 0)
106
    {
107
        action = 3;
108
        wait = 100;
109
        xx = x;
110
        yy = y;
111
        image_index = 0;
112
    }
113
}
114
if (action == 3)
115
{
116
    image_blend = merge_colour(c_red, image_blend, wait / 100);
117
    x = xx + choose(-2, 2);
118
    y = yy + choose(-2, 2);
119
    if (wait == 0)
120
    {
121
        action = 4;
122
        wait = 15;
123
        speed = 5;
124
        sprite_index = spr_mike_cat_attack_outline;
125
        direction = point_direction(x, y, obj_mike_controller.x, obj_mike_controller.y) - 180;
126
        instance_create_depth(x, y, depth - 1, obj_mike_hairball);
127
        snd_stop(snd_meow_quick);
128
        snd_play(snd_meow_quick);
129
    }
130
}
131
if (action == 4)
132
{
133
    wait -= 1;
134
    if (wait < 0 && speed == 0)
135
    {
136
        sprite_index = spr_mike_cat_walk_outline;
137
        image_speed = 2;
138
        friction = -0.25;
139
        xscale = -xscale;
140
        motion_set(direction, 0.25);
141
    }
142
}
143
if (action == 5)
144
{
145
    if (lastaction != 5)
146
    {
147
        sprite_index = spr_mike_cat_hold_outline;
148
        if ((abs(hspeed) + abs(vspeed)) > 22)
149
        {
150
            snd_play(snd_criticalswing);
151
            is_launched = true;
152
        }
153
        else
154
        {
155
            snd_play(snd_wing);
156
            is_launched = false;
157
        }
158
    }
159
    if (is_launched)
160
    {
161
        with (
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
())
162
            image_alpha = 0.3;
163
    }
164
    if (y >= (cameray() + 310))
165
    {
166
        vspeed = 0;
167
        y = cameray() + 310;
168
        gravity = 0;
169
        friction = 0;
170
        side = choose(1, -1);
171
        xscale = side;
172
        hspeed = side * irandom_range(3, 5);
173
        sprite_index = spr_mike_cat_walk_outline;
174
        action = 0;
175
    }
176
    else
177
    {
178
        if (y < 0)
179
        {
180
            y = 0;
181
            vspeed = -vspeed;
182
        }
183
        gravity = 1;
184
    }
185
    if (x > (camerax() + camerawidth()))
186
        hspeed = -hspeed;
187
    if (x < camerax())
188
        hspeed = -hspeed;
189
}
190
lastaction = action;
191
192
enum e__VW
193
{
194
    XView,
195
    YView,
196
    WView,
197
    HView,
198
    Angle,
199
    HBorder,
200
    VBorder,
201
    HSpeed,
202
    VSpeed,
203
    Object,
204
    Visible,
205
    XPort,
206
    YPort,
207
    WPort,
208
    HPort,
209
    Camera,
210
    SurfaceID
211
}