Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_darkslide_new_Collision_obj_mainchara

(view raw script w/o annotations or w/e)
1
var solidcheck = 0;
2
cancollide = 0;
3
if (sliding == 0 && global.interact == 0)
4
{
5
    if (obj_mainchara.y < ((y + sprite_height) - obj_mainchara.sprite_height))
6
    {
7
        with (obj_mainchara)
8
        {
9
            if (place_meeting(x, y + 20, obj_solidblock))
10
                solidcheck = 1;
11
        }
12
        if (solidcheck == 0)
13
        {
14
            if (!no_start_sound)
15
                snd_play(snd_noise);
16
            if (!no_slide_sound)
17
                slide_noise = snd_loop(snd_paper_surf);
18
            with (obj_mainchara)
19
            {
20
                sliding = 1;
21
                fun = 1;
22
                sprite_index = spr_krisd_slide;
23
            }
24
            sliding = 1;
25
        }
26
    }
27
    else
28
    {
29
        obj_mainchara.y = (y + sprite_height) - 48;
30
    }
31
}
32
if (sliding == 1)
33
{
34
    collide = 1;
35
    global.interact = 1;
36
    other.y += 12;
37
    collidetimer = 1;
38
    collider += 1;
39
    if (slidetimer == 0)
40
    {
41
        dust = instance_create(obj_mainchara.x + 20, obj_mainchara.y + 30, obj_slidedust);
42
        with (dust)
43
        {
44
            vspeed = -6;
45
            hspeed = -1 + random(2);
46
        }
47
        slidetimer = -3;
48
    }
49
    slidetimer += 1;
50
    if (slidetimer >= 1)
51
        slidetimer = -3;
52
    if (move_lr_enabled)
53
    {
54
        if (left_h())
55
        {
56
            with (obj_mainchara)
57
            {
58
                _px = -6;
59
                if (!place_meeting(x + _px, y, obj_solidblock))
60
                    x += _px;
61
            }
62
        }
63
        if (right_h())
64
        {
65
            with (obj_mainchara)
66
            {
67
                _px = 6;
68
                if (!place_meeting(x + _px, y, obj_solidblock))
69
                    x += _px;
70
            }
71
        }
72
        solidcheck = 0;
73
        with (obj_mainchara)
74
        {
75
            if (place_meeting(x, y + 20, obj_solidblock))
76
                solidcheck = 1;
77
        }
78
        if (solidcheck == 1)
79
            instant_end_sliding = 1;
80
    }
81
}