Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mike_cat_Step_0

(view raw script w/o annotations or w/e)
1
if (wall_destroy == 1)
2
{
3
    if (x < (__view_get(e__VW.XView, 0) - 80))
4
        instance_destroy();
5
    if (x > (__view_get(e__VW.XView, 0) + 760))
6
        instance_destroy();
7
    if (y < (__view_get(e__VW.YView, 0) - 80))
8
        instance_destroy();
9
    if (y > (__view_get(e__VW.YView, 0) + 580))
10
        instance_destroy();
11
}
12
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))
13
{
14
    wall_destroy = 1;
15
}
16
scale += ((1 - scale) * 0.25);
17
image_xscale += ((scale - image_xscale) * 0.25);
18
image_yscale = image_xscale;
19
if (speed > max_speed)
20
    speed = max_speed;
21
if (action == 0)
22
{
23
    wait -= 1;
24
    if (wait < 0)
25
    {
26
        motion_add(point_direction(x, y, xstart, ystart), 0.25);
27
        if ((point_distance(x, y, obj_mike_attack_controller.x, obj_mike_controller.y) < mydist && !flip) || point_distance(x, y, xstart, ystart) < 10)
28
        {
29
            friction = 0.5;
30
            image_alpha = 1;
31
            active = true;
32
            action = 2;
33
            wait = wait_time;
34
            xx = x;
35
            yy = y;
36
            image_index = 0;
37
            image_speed = 0;
38
            if (flip)
39
                side = -side;
40
        }
41
    }
42
}
43
if (action == 2)
44
{
45
    x = clamp(x, 40, 600);
46
    y = clamp(y, -40, room_height - 40);
47
    wait -= 1;
48
    if (wait < (wait_time * 0.25))
49
    {
50
        x = xx + choose(-2, 2);
51
        y = yy + choose(-2, 2);
52
    }
53
    else
54
    {
55
        xx = x;
56
        yy = y;
57
    }
58
    image_blend = merge_colour(c_red, c_white, wait / wait_time);
59
    if (wait <= 0)
60
    {
61
        action = 3;
62
        wait = 15;
63
        image_speed = 0.5;
64
        sprite_index = spr_mike_cat_attack;
65
        direction = point_direction(x, y, obj_mike_controller.x, obj_mike_controller.y) - 180;
66
        instance_create_depth(x, y, depth - 1, obj_mike_hairball);
67
        meow = snd_play(snd_meow_angry);
68
        sound_pitch(meow, random_range(0.9, 1.1));
69
    }
70
}
71
if (action == 3)
72
{
73
    wait -= 1;
74
    if (wait < 0 && speed == 0)
75
    {
76
        sprite_index = spr_mike_cat_walk;
77
        image_speed = 1;
78
        friction = -0.5;
79
        direction = point_direction(x, y, obj_mike_controller.x, obj_mike_controller.y) - 180;
80
        motion_set(direction, 1);
81
        if (x > obj_mike_controller.x)
82
            side = 1;
83
        else
84
            side = -1;
85
    }
86
}
87
if (sprite_index == spr_mike_cat_dance)
88
    image_alpha -= 0.05;
89
90
enum e__VW
91
{
92
    XView,
93
    YView,
94
    WView,
95
    HView,
96
    Angle,
97
    HBorder,
98
    VBorder,
99
    HSpeed,
100
    VSpeed,
101
    Object,
102
    Visible,
103
    XPort,
104
    YPort,
105
    WPort,
106
    HPort,
107
    Camera,
108
    SurfaceID
109
}