Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_maus_critter_Draw_0

(view raw script w/o annotations or w/e)
1
if (init >= 2)
2
{
3
    var _inbounds = x > (obj_growtangle.x - 50) && x < (obj_growtangle.y + 50) && y > (obj_growtangle.y - 50) && y < (obj_growtangle.y + 50);
4
    var offset = 0;
5
    if (alarm[0] && speed == 0)
6
    {
7
        if ((alarm[0] % 4) == 2)
8
            offset = 1;
9
        else if ((alarm[0] % 4) > 0)
10
            offset = 2;
11
        if (alarm[0] < 4)
12
            offset *= -1;
13
    }
14
    if (!_inbounds)
15
        scr_draw_in_box_ext_begin(26, 26);
16
    if (big && sprite_index != spr_maus_critter_stuck)
17
    {
18
        var _changeDist = 60;
19
        if ((direction == 0 && x > (obj_growtangle.x + _changeDist)) || (direction == 90 && y < (obj_growtangle.y - _changeDist)) || (direction == 180 && x < (obj_growtangle.x - _changeDist)) || (direction == 270 && y > (obj_growtangle.y + _changeDist)))
20
            sprite_index = spr_maus_critter_stuck;
21
    }
22
    if ((direction % 180) == 0)
23
        draw_sprite_ext(sprite_index, image_index, x, y + (offset * sign(direction - 135)), image_xscale, image_yscale, image_angle, image_blend, image_alpha);
24
    else
25
        draw_sprite_ext(sprite_index, image_index, x + (offset * sign(direction - 135)), y, image_xscale, image_yscale, image_angle, image_blend, image_alpha);
26
    if (!_inbounds)
27
        scr_draw_in_box_end
scr_draw_in_box_end

function scr_draw_in_box_end() { if (!instance_exists(obj_growtangle)) exit; gpu_set_alphatestref(128); gpu_set_alphatestenable(false); gpu_set_blendmode(bm_normal); }
();
28
}
29
else
30
{
31
    var eyeframe = 0;
32
    if (eyetimer < 18)
33
    {
34
        if (eyetimer >= 0)
35
            eyeframe++;
36
        if (eyetimer >= 2)
37
            eyeframe++;
38
        if (eyetimer >= 16)
39
            eyeframe++;
40
    }
41
    draw_sprite_ext(spr_maus_eyes, eyeframe, x, y, 1, 1, direction, c_white, 1);
42
    eyetimer++;
43
    if (eyetimer >= 20)
44
    {
45
        active = 1;
46
        init = 2;
47
        speed = initialspeed;
48
    }
49
}