Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_dw_church_climbingcup_Step_0

(view raw script w/o annotations or w/e)
1
var watchboy = 1049;
2
with (obj_climb_kris)
3
    watchboy = id;
4
var heardist = 400;
5
var climbvol = 0;
6
if (i_ex(watchboy))
7
    climbvol = clamp((heardist - point_distance(x, y, watchboy.x, watchboy.y)) / heardist, 0, 1);
8
if (!
scr_onscreen
scr_onscreen

function
scr_onscreen(arg0)
{ obj = arg0; spacer = 0; if ((obj.x + obj.sprite_width + spacer) < camerax() || (obj.x - spacer) > (camerax() + 640) || (obj.y + obj.sprite_height + spacer) < cameray() || (obj.y - spacer) > (cameray() + 480)) return false; else return true; }
(id))
9
    climbvol = 0;
10
var climbvolthresh = 0.1;
11
if (!init)
12
{
13
    init = 1;
14
    mymaxheight = ystart - maxheight;
15
    targtime = irandom(mymaxheight);
16
    timer = 0;
17
}
18
if (con == 0 && global.interact != 2)
19
{
20
    timer++;
21
    y--;
22
    image_index += 0.25;
23
    if ((image_index % 1) == 0)
24
    {
25
        if (climbvol > climbvolthresh)
26
            snd_play(snd_menumove, 0.25 * climbvol, 0.4 + (image_index / 10));
27
    }
28
    if (timer >= (targtime - 40) && (timer % 2) == 0)
29
    {
30
        if (climbvol > climbvolthresh)
31
        {
32
            with (
scr_marker_ext
scr_marker_ext

function
scr_marker_ext(arg0, arg1, arg2, arg3 = 1, arg4 = 1, arg5 = 0, arg6 = 0, arg7 = 16777215, arg8 = depth, arg9 = false, arg10 = -1, arg11 = 1)
{ var thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { depth = arg8; sprite_index = arg2; image_speed = arg5; image_xscale = arg3; image_yscale = arg4; image_index = arg6; image_blend = arg7; image_alpha = arg11; if (arg9)
scr_depth_alt();
} if (arg10 > 0)
scr_doom(thismarker, arg10);
return thismarker; } function scr_marker_fromasset(arg0, arg1 = depth, arg2 = false) { if (is_undefined(arg0)) { debug_message("Warning: scr_marker_fromasset() sprite_instance didn't exist"); return -4; } var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var imagespeed = layer_sprite_get_speed(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var thismarker = instance_create_depth(xloc, yloc, arg1, obj_marker); with (thismarker) { sprite_index = sprite; image_index = index; image_speed = imagespeed; image_xscale = xscale; image_yscale = yscale; image_angle = angle; image_blend = blend; image_alpha = alpha; if (arg2)
scr_depth_alt(id, arg2);
} return thismarker; } function scr_assetgetinfo(arg0) { var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var imagespeed = layer_sprite_get_speed(arg0); return [sprite, index, xloc, yloc, xscale, yscale, angle, blend, alpha, imagespeed]; }
(x + 20, y + 34, spr_pxwhite, 2, 2, undefined, undefined, undefined, undefined, undefined, 8))
33
            {
34
                depth = other.depth + 1;
35
                hspeed = choose(-4, 3, -3, 4);
36
                vspeed = -4;
37
                gravity = random_range(0.3, 0.6);
38
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("image_alpha", 1, 0, 8);
39
            }
40
        }
41
    }
42
    if (timer >= (targtime - 20))
43
    {
44
        if ((timer % 2) == 0)
45
            y++;
46
    }
47
    if (timer >= targtime)
48
    {
49
        con = 1;
50
        targtime = irandom(abs(ystart - y));
51
    }
52
}
53
if (con == 1)
54
{
55
    gravity = 1;
56
    timer++;
57
    if (timer >= targtime || y >= (ystart - 30))
58
    {
59
        if (climbvol > climbvolthresh)
60
            snd_play(snd_menumove, 0.25 * climbvol, 0.2);
61
        gravity = 0;
62
        vspeed = 0;
63
        timer = 0;
64
        var targy = clamp(y + 20, y, ystart);
65
        targtime = irandom(10) + 20;
66
        
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("y", y, targy, 20, -1, "out");
67
        if (climbvol > climbvolthresh)
68
        {
69
            snd_play_delay(snd_menumove, 1, 0.25 * climbvol, 0.25);
70
            snd_play_delay(snd_menumove, 3, 0.25 * climbvol, 0.23);
71
            snd_play_delay(snd_menumove, 5, 0.25 * climbvol, 0.21);
72
        }
73
        con = 2;
74
    }
75
}
76
if (con == 2)
77
{
78
    y = round(y);
79
    timer++;
80
    if (timer == targtime)
81
    {
82
        timer = 0;
83
        targtime = irandom(y - maxheight);
84
        con = 0;
85
    }
86
}
87
if (con < 99)
88
{
89
    if (place_meeting(x, y, obj_climb_kris))
90
    {
91
        con = 100;
92
        gravity = 1;
93
        snd_play(snd_smallcar_yelp, 0.75, 0.6);
94
    }
95
}
96
if (con == 100)
97
{
98
    if (y > (cameray() + 480 + 80))
99
        instance_destroy();
100
}