Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_floorSwitcher_Step_0

(view raw script w/o annotations or w/e)
1
with (obj_floorTrigger)
2
{
3
    if (other.activeFloor != floortarg)
4
    {
5
        if (place_meeting(x, y, obj_mainchara))
6
        {
7
            other.activeFloor = floortarg;
8
            other.switchFloors = 1;
9
        }
10
    }
11
}
12
if (switchFloors == 1)
13
{
14
    with (obj_solid_floor)
15
    {
16
        if (myfloor != other.activeFloor)
17
        {
18
            active = false;
19
            init = 0;
20
        }
21
        else
22
        {
23
            active = true;
24
            init = 0;
25
        }
26
    }
27
    if (activeFloor == 0)
28
    {
29
        if (floor1 != -1)
30
            layer_depth(floor1, 6000);
31
        if (floor2 != -1)
32
            layer_depth(floor2, 5000);
33
    }
34
    if (activeFloor == 1)
35
    {
36
        if (floor1 != -1)
37
            layer_depth(floor1, floor1depthmem);
38
        if (floor2 != -1)
39
            layer_depth(floor2, 5000);
40
    }
41
    if (activeFloor == 2)
42
    {
43
        if (floor1 != -1)
44
            layer_depth(floor1, floor1depthmem);
45
        if (floor2 != -1)
46
            layer_depth(floor2, floor2depthmem);
47
    }
48
    switchFloors = 0;
49
}
50
if (i_ex(obj_ladderarea))
51
{
52
    with (obj_ladderarea)
53
    {
54
        if (place_meeting(x, y, obj_mainchara))
55
        {
56
            engaged = true;
57
            global.interact = 1;
58
        }
59
        else if (engaged == true)
60
        {
61
            engaged = false;
62
            global.interact = 0;
63
        }
64
        if (engaged == true)
65
        {
66
            obj_mainchara.sprite_index = spr_krisu_dark;
67
            global.facing = 2;
68
            if (up_h())
69
            {
70
                obj_mainchara.y -= 4;
71
                image_speed = 0.25;
72
            }
73
            if (down_h())
74
            {
75
                obj_mainchara.y += 4;
76
                image_speed = 0.25;
77
            }
78
            if ((up_h() && down_h()) || (!up_h() && !down_h()))
79
                obj_mainchara.image_speed = 0;
80
        }
81
    }
82
}