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