Deltarune (Chapter 2) 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
        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);
10
        body_obj.sprite_index = target.sprite_index;
11
        body_obj.image_index = target.image_index;
12
        body_obj.image_speed = target.image_speed;
13
        body_obj.image_xscale = target.image_xscale;
14
        body_obj.image_yscale = target.image_yscale;
15
        body_obj.depth = target.depth;
16
        checksprite = body_obj.sprite_index;
17
        var __depthcheck = 0;
18
        with (body_obj)
19
        {
20
            _remdepth = depth;
21
            
scr_depth
scr_depth

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
22
            if (_remdepth != depth)
23
                __depthcheck = 1;
24
            depth = _remdepth;
25
        }
26
        if (__depthcheck == 1)
27
            ignoredepth = 1;
28
        remy = y;
29
        shadowoffx = 0;
30
        shadowoffy = 0;
31
        shadowheight = sprite_get_height(checksprite);
32
        y = endy;
33
        
scr_depth
scr_depth

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

function
scr_depth()
{ depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
107
            depth -= 5000;
108
            body_obj.depth = depth;
109
        }
110
        if (timer >= jumptime)
111
        {
112
            body_obj.x = falseendx;
113
            body_obj.y = falseendy;
114
            target.x = endx;
115
            target.y = endy;
116
            con = 3;
117
            usespritestimer = 0;
118
        }
119
    }
120
    if (con == 3)
121
    {
122
        if (usesprites == 1)
123
        {
124
            body_obj.sprite_index = landsprite;
125
            usespritestimer++;
126
        }
127
        else
128
        {
129
            usespritestimer = 10;
130
        }
131
        if (usespritestimer >= 5)
132
        {
133
            target.visible = 1;
134
            instance_destroy();
135
        }
136
    }
137
}
138
else
139
{
140
    instance_destroy();
141
}
142
if (i_ex(body_obj))
143
    body_obj.image_alpha = image_alpha;