Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_caterpillarchara_susiebreakspots_Step_0

(view raw script w/o annotations or w/e)
1
if (con == 0 && global.interact == 0 && susiestart == 1)
2
{
3
    susid = -4;
4
    var bossid = id;
5
    with (obj_caterpillarchara)
6
    {
7
        if (name == "susie")
8
        {
9
            visible = 0;
10
            bossid.caterpillarid = id;
11
            bossid.susid = instance_create(x, y, obj_actor);
12
            with (bossid.susid)
13
            {
14
                
scr_set_facing_sprites
scr_set_facing_sprites

function
scr_set_facing_sprites(arg0)
{ _actorname = arg0; name = arg0; if (is_string(_actorname)) { if (_actorname == "kris") { name = "kris"; if (global.darkzone == 0) _actorname = "krislight"; if (global.darkzone == 1) _actorname = "krisdark"; } if (_actorname == "susie") { name = "susie"; if (global.darkzone == 0) { _actorname = "susielight"; if (global.chapter >= 2) _actorname = "susielighteyes"; } if (global.darkzone == 1) { if (global.chapter == 1) _actorname = "susiedark"; if (global.chapter >= 2) _actorname = "susiedarkeyes"; } } if (_actorname == "ralsei") { name = "ralsei"; if (global.chapter <= 1) _actorname = "ralseihat"; if (global.chapter > 1) _actorname = "ralseinohat"; } if (_actorname == "noelle") { name = "noelle"; if (global.darkzone == 0) _actorname = "noellelight"; if (global.darkzone == 1) _actorname = "noelledark"; } if (_actorname == "berdly") { name = "berdly"; if (global.darkzone == 0) _actorname = "berdlylight"; if (global.darkzone == 1) _actorname = "berdlydark"; } if (_actorname == "krislight") { usprite = spr_krisu; rsprite = spr_krisr; dsprite = spr_krisd; lsprite = spr_krisl; } if (_actorname == "krisdark") { usprite = spr_krisu_dark; rsprite = spr_krisr_dark; dsprite = spr_krisd_dark; lsprite = spr_krisl_dark; } if (_actorname == "susielight") { usprite = spr_susieu; rsprite = spr_susier; dsprite = spr_susied; lsprite = spr_susiel; } if (_actorname == "susielighteyes") { usprite = spr_susie_walk_up_lw; rsprite = spr_susie_walk_right_lw; dsprite = spr_susie_walk_down_lw; lsprite = spr_susie_walk_left_lw; } if (_actorname == "susiedark") { usprite = spr_susieu_dark; rsprite = spr_susier_dark; dsprite = spr_susied_dark; lsprite = spr_susiel_dark; specialsprite[4] = spr_susie_shock_r; specialsprite[5] = spr_susie_shock; } if (_actorname == "susiedarkeyes") { usprite = spr_susie_walk_up_dw; rsprite = spr_susie_walk_right_dw; dsprite = spr_susie_walk_down_dw; lsprite = spr_susie_walk_left_dw; specialsprite[4] = spr_susie_shock_r; specialsprite[5] = spr_susie_shock; } ...
("susie");
15
                sprite_index = rsprite;
16
            }
17
        }
18
    }
19
    if (susid == -4)
20
        instance_destroy();
21
    else
22
        con = 1;
23
}
24
if (con == 1)
25
{
26
    if (global.interact == 0)
27
    {
28
        if (instance_exists(obj_queenvase))
29
        {
30
            with (susid)
31
            {
32
                
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
33
                nearestpot = instance_nearest(x + (sprite_width / 2), (y + sprite_height) - 2, obj_queenvase);
34
                if (collision_line(x + (sprite_width / 2), (y + sprite_height) - 2, nearestpot.x + 20, nearestpot.y + 52, obj_solidblock, true, false) == -4)
35
                {
36
                    direction = point_direction(x + (sprite_width / 2), (y + sprite_height) - 2, nearestpot.x + 20, (nearestpot.y + 52) - 10);
37
                    fake_speed = 
scr_move_step_solids_direction
scr_move_step_solids_direction

function
scr_move_step_solids_direction(arg0, arg1)
{ var __mx = lengthdir_x(arg0, arg1); var __my = lengthdir_y(arg0, arg1); if (place_meeting(x + __mx, y + __my, obj_solidblock)) { if (!place_meeting(x + __mx, y, obj_solidblock)) __my = 0; else if (!place_meeting(x, y + __my, obj_solidblock)) __mx = 0; } x += __mx; y += __my; return point_distance(0, 0, __mx, __my); }
(8, direction);
38
                    fake_direction = direction;
39
                }
40
                else
41
                {
42
                    other.con = 2;
43
                }
44
                if (place_meeting(x, y, obj_queenvase))
45
                {
46
                    other.timer = 0;
47
                    other.con = 1.1;
48
                    image_index = 0;
49
                    sprite_index = spr_susie_right_diagonal_kick_dw;
50
                }
51
            }
52
        }
53
        else
54
        {
55
            con = 2;
56
        }
57
    }
58
}
59
if (con == 1.1)
60
{
61
    if (!i_ex(kick))
62
    {
63
        kick = instance_create(susid.x, susid.y, obj_marker);
64
        kick.sprite_index = spr_susie_right_diagonal_kick_dw;
65
        kick.visible = true;
66
        if ((susid.x + (susid.sprite_width / 2)) > susid.nearestpot.x)
67
            kick.sprite_index = spr_susie_left_diagonal_kick_dw;
68
        kick.image_xscale = 2;
69
        kick.image_yscale = 2;
70
        kick.image_speed = 0.25;
71
        with (kick)
72
            
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
73
        susid.visible = false;
74
    }
75
    if (kick.image_index == 2)
76
        susid.active = 1;
77
    if (kick.image_index == 4)
78
    {
79
        susid.active = 0;
80
        susid.visible = true;
81
        with (kick)
82
            instance_destroy();
83
        con = 1;
84
    }
85
}
86
if (con == 2)
87
{
88
    if (global.interact == 0)
89
    {
90
        var caid = caterpillarid;
91
        with (susid)
92
        {
93
            direction = point_direction(x, y, caid.x, caid.y);
94
            fake_direction = direction;
95
            fake_speed = 
scr_move_step_solids_direction
scr_move_step_solids_direction

function
scr_move_step_solids_direction(arg0, arg1)
{ var __mx = lengthdir_x(arg0, arg1); var __my = lengthdir_y(arg0, arg1); if (place_meeting(x + __mx, y + __my, obj_solidblock)) { if (!place_meeting(x + __mx, y, obj_solidblock)) __my = 0; else if (!place_meeting(x, y + __my, obj_solidblock)) __mx = 0; } x += __mx; y += __my; return point_distance(0, 0, __mx, __my); }
(8, direction);
96
        }
97
        if ((abs(susid.x - caterpillarid.x) + abs(susid.y - caterpillarid.y)) < 12)
98
        {
99
            with (susid)
100
                instance_destroy();
101
            caterpillarid.visible = 1;
102
            con = 0;
103
            instance_destroy();
104
        }
105
    }
106
    else
107
    {
108
        with (susid)
109
            fake_speed = 0;
110
    }
111
}