Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_maus_critter_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    initialspeed = speed;
4
    speed = 0;
5
    init = 1;
6
    depth -= 2;
7
    if (big)
8
        stuck = true;
9
}
10
if (init == 2)
11
{
12
    depth += 2;
13
    init = 3;
14
}
15
if (init < 3)
16
    exit;
17
if (big && alarm[0]
 == -1)
gml_Object_obj_maus_critter_Alarm_0.gml

if (speed != 0) { speed = 0; alarm[0]
 = 8;
sprite_index = spr_maus_critter_stuck; }
18
{
19
    speed = 
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; }
(speed, initialspeed, 0.75);
20
    if (stuck && speed > 2)
21
    {
22
        sprite_index = spr_maus_critter_big;
23
        stuck = false;
24
    }
25
}
26
event_inherited();
27
if (x > (obj_growtangle.x + (obj_growtangle.sprite_width / 2) + 50) || x < (obj_growtangle.x - (obj_growtangle.sprite_width / 2) - 50) || y > (obj_growtangle.y + (obj_growtangle.sprite_height / 2) + 50) || y < (obj_growtangle.y - (obj_growtangle.sprite_height / 2) - 50))
28
    instance_destroy();