Deltarune (Chapter 3) 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
        ignoredepth = 0;
8
        init = 1;
9
        if (board == false)
10
            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);
11
        else
12
            body_obj = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
(target.x, target.y, target.sprite_index);
13
        body_obj.sprite_index = target.sprite_index;
14
        body_obj.image_index = target.image_index;
15
        body_obj.image_speed = target.image_speed;
16
        body_obj.image_xscale = target.image_xscale;
17
        body_obj.image_yscale = target.image_yscale;
18
        body_obj.depth = target.depth;
19
        checksprite = body_obj.sprite_index;
20
        var __depthcheck = 0;
21
        with (body_obj)
22
        {
23
            _remdepth = depth;
24
            
scr_depth
scr_depth

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

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

function
scr_depth()
{ if (argument_count > 0) { with (argument0) depth = 100000 - ((y * 10) + (sprite_height * 10)); } else { depth = 100000 - ((y * 10) + (sprite_height * 10)); } }
();
113
            depth -= 5000;
114
            body_obj.depth = depth;
115
        }
116
        if (timer >= jumptime)
117
        {
118
            body_obj.x = falseendx;
119
            body_obj.y = falseendy;
120
            target.x = endx;
121
            target.y = endy;
122
            con = 3;
123
            usespritestimer = 0;
124
        }
125
    }
126
    if (con == 3)
127
    {
128
        if (usesprites == 1)
129
        {
130
            body_obj.sprite_index = landsprite;
131
            usespritestimer++;
132
        }
133
        else
134
        {
135
            usespritestimer = 10;
136
        }
137
        if (usespritestimer >= 5)
138
        {
139
            target.visible = 1;
140
            instance_destroy();
141
        }
142
    }
143
}
144
else
145
{
146
    instance_destroy();
147
}
148
if (i_ex(body_obj))
149
    body_obj.image_alpha = image_alpha;
150
if (i_ex(body_obj) && i_ex(target))
151
{
152
    if (trackalpha)
153
        body_obj.image_alpha = target.image_alpha;
154
    if (trackblend)
155
        body_obj.image_blend = target.image_blend;
156
    if (trackindex)
157
        body_obj.image_index = target.image_index;
158
    if (tracksprite)
159
        body_obj.sprite_index = target.sprite_index;
160
}