Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_jump_to_point_Step_0

(view raw script w/o annotations or w/e)
1
if (i_ex(target))
2
{
3
    if (init == 0)
4
    {
5
        dark = global.darkzone + 1;
6
        fakegravity = jumpspeed / (jumptime * 0.5);
7
        fakegravitystart = fakegravity;
8
        ignoredepth = 0;
9
        init = 1;
10
        if (board == false)
11
            body_obj = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(target.x, target.y, target.sprite_index);
12
        else
13
            body_obj = scr_board_marker(target.x, target.y, target.sprite_index);
14
        body_obj.sprite_index = target.sprite_index;
15
        body_obj.image_index = target.image_index;
16
        body_obj.image_speed = target.image_speed;
17
        body_obj.image_xscale = target.image_xscale;
18
        body_obj.image_yscale = target.image_yscale;
19
        body_obj.depth = target.depth;
20
        checksprite = body_obj.sprite_index;
21
        var __depthcheck = 0;
22
        with (body_obj)
23
        {
24
            _remdepth = depth;
25
            
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
26
            if (_remdepth != depth)
27
                __depthcheck = 1;
28
            depth = _remdepth;
29
        }
30
        if (__depthcheck == 1)
31
            ignoredepth = 1;
32
        remy = y;
33
        shadowoffx = 0;
34
        shadowoffy = 0;
35
        shadowheight = sprite_get_height(checksprite);
36
        y = endy;
37
        
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
38
        y = remy;
39
        target.visible = 0;
40
        fakeendx = endx;
41
        fakeendy = endy;
42
        if (usesprites == 1)
43
        {
44
            usespritetimer = 0;
45
            if (landsprite > 0)
46
            {
47
                body_obj.sprite_index = landsprite;
48
                body_obj.image_speed = 0;
49
                body_obj.image_index = 0;
50
                if (landsprite == spr_kris_dw_landed)
51
                {
52
                    body_obj.x -= 2 * dark;
53
                    body_obj.y += 1 * dark;
54
                    fakeendx -= (4 * dark);
55
                    startx -= (4 * dark);
56
                    starty -= (4 * dark);
57
                }
58
                if (landsprite == spr_susie_dw_landed)
59
                {
60
                    body_obj.x -= 4 * dark;
61
                    fakeendx -= (4 * dark);
62
                    startx += (6 * dark);
63
                    starty -= (6 * dark);
64
                }
65
                if (global.chapter == 2)
66
                {
67
                    if (landsprite == spr_teacup_ralsei_land)
68
                    {
69
                        body_obj.y += 2 * dark;
70
                        starty += 4;
71
                        startx -= 6;
72
                        fakeendx -= 6;
73
                        fakeendy += (2 * dark);
74
                    }
75
                }
76
                if (jumpsprite == spr_ralsei_jump)
77
                {
78
                    shadowoffx -= 10;
79
                    shadowoffy -= 4;
80
                }
81
            }
82
            con = 1;
83
        }
84
        else
85
        {
86
            con = 2;
87
        }
88
    }
89
    if (con == 1)
90
    {
91
        usespritestimer++;
92
        if (usespritestimer >= 5)
93
        {
94
            body_obj.sprite_index = jumpsprite;
95
            body_obj.image_speed = 0.25;
96
            con = 2;
97
        }
98
    }
99
    if (con == 2)
100
    {
101
        if (titanslowmo && timer > 5)
102
        {
103
            titanslowmotimer++;
104
            timer += lerp(1, 0.1, titanslowmotimer / 70);
105
            fakegravity = lerp(fakegravitystart, fakegravitystart / 10, titanslowmotimer / 70);
106
            if (fakegravity < 0.1)
107
                fakegravity = 0.1;
108
            if (jumpspeed < 0.3)
109
                jumpspeed = 0.3;
110
        }
111
        else
112
        {
113
            timer++;
114
        }
115
        jumpspeed -= fakegravity;
116
        jumpy -= jumpspeed;
117
        x = lerp(startx, fakeendx, timer / jumptime);
118
        nowy = lerp(starty, fakeendy, timer / jumptime);
119
        y = nowy;
120
        target.x = x;
121
        target.y = nowy;
122
        body_obj.x = x;
123
        body_obj.y = nowy + jumpy;
124
        if (ignoredepth == 0)
125
        {
126
            
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
127
            depth -= 5000;
128
            body_obj.depth = depth;
129
        }
130
        if (timer >= jumptime)
131
        {
132
            body_obj.x = fakeendx;
133
            body_obj.y = fakeendy;
134
            target.x = endx;
135
            target.y = endy;
136
            con = 3;
137
            usespritestimer = 0;
138
        }
139
    }
140
    if (con == 3)
141
    {
142
        if (usesprites == 1)
143
        {
144
            body_obj.sprite_index = landsprite;
145
            usespritestimer++;
146
        }
147
        else
148
        {
149
            usespritestimer = 10;
150
        }
151
        if (usespritestimer >= 5)
152
        {
153
            target.visible = 1;
154
            instance_destroy();
155
        }
156
    }
157
}
158
else
159
{
160
    instance_destroy();
161
}
162
if (i_ex(body_obj))
163
    body_obj.image_alpha = image_alpha;
164
if (i_ex(body_obj) && i_ex(target))
165
{
166
    if (trackalpha)
167
        body_obj.image_alpha = target.image_alpha;
168
    if (trackblend)
169
        body_obj.image_blend = target.image_blend;
170
    if (trackindex)
171
        body_obj.image_index = target.image_index;
172
    if (tracksprite)
173
        body_obj.sprite_index = target.sprite_index;
174
    if (trackangle)
175
        body_obj.image_angle = target.image_angle;
176
}