Deltarune 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
            snd_play(snd_noise);
15
            if (room == room_dw_cyber_teacup_final)
16
                snd_play(snd_paper_surf);
17
            else
18
                slide_noise = snd_loop(snd_paper_surf);
19
            with (obj_mainchara)
20
            {
21
                sliding = 1;
22
                fun = 1;
23
                sprite_index = spr_krisd_slide;
24
            }
25
            sliding = 1;
26
        }
27
    }
28
    else
29
    {
30
        obj_mainchara.y = (y + sprite_height) - 48;
31
    }
32
}
33
if (sliding == 1)
34
{
35
    collide = 1;
36
    global.interact = 1;
37
    other.y += 12;
38
    collidetimer = 1;
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
}