Deltarune script viewer

← back to main script listing

gml_Object_obj_caterpillarchara_ch1_Step_2

(view raw script w/o annotations or w/e)
1
scr_depth_ch1
scr_depth_ch1

function scr_depth_ch1() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
2
depth += 5;
3
nowx = x;
4
nowy = y;
5
moved = 0;
6
walk = 0;
7
runmove = 0;
8
if (obj_mainchara_ch1.x != remx[0])
9
    moved = 1;
10
if (obj_mainchara_ch1.y != remy[0])
11
    moved = 1;
12
if (moved == 1)
13
{
14
    blushtimer = 0;
15
    for (i = 25; i > 0; i -= 1)
16
    {
17
        remx[i] = remx[i - 1];
18
        remy[i] = remy[i - 1];
19
        facing[i] = facing[i - 1];
20
    }
21
    remx[0] = obj_mainchara_ch1.x;
22
    remy[0] = obj_mainchara_ch1.y;
23
    facing[0] = global.facing;
24
    if (usprite == spr_susieu_dark_ch1)
25
        x = remx[target] - 6;
26
    else
27
        x = remx[target] - 4;
28
    if (usprite == spr_susieu_dark_ch1)
29
        y = remy[target] - 16;
30
    else
31
        y = remy[target] - 12;
32
    if (abs(remx[target + 1] - remx[target]) > 4)
33
        runmove = 1;
34
    if (abs(remy[target + 1] - remy[target]) > 4)
35
        runmove = 1;
36
    dir = facing[target];
37
}
38
if (x != nowx)
39
    walk = 1;
40
if (y != nowy)
41
    walk = 1;
42
if (walk == 1)
43
    walkbuffer = 6;
44
if (walkbuffer > 3 && fun == 0)
45
{
46
    walktimer += 1.5;
47
    if (runmove == 1)
48
        walktimer += 1.5;
49
    if (walktimer >= 40)
50
        walktimer -= 40;
51
    if (walktimer < 10)
52
        image_index = 0;
53
    if (walktimer >= 10)
54
        image_index = 1;
55
    if (walktimer >= 20)
56
        image_index = 2;
57
    if (walktimer >= 30)
58
        image_index = 3;
59
}
60
if (walkbuffer <= 0 && fun == 0)
61
{
62
    if (walktimer < 10)
63
        walktimer = 9.5;
64
    if (walktimer >= 10 && walktimer < 20)
65
        walktimer = 19.5;
66
    if (walktimer >= 20 && walktimer < 30)
67
        walktimer = 29.5;
68
    if (walktimer >= 30)
69
        walktimer = 39.5;
70
    image_index = 0;
71
}
72
walkbuffer -= 0.75;
73
if (fun == 0)
74
{
75
    if (facing[target] == 0)
76
        sprite_index = dsprite;
77
    if (facing[target] == 1)
78
        sprite_index = rsprite;
79
    if (facing[target] == 2)
80
        sprite_index = usprite;
81
    if (facing[target] == 3)
82
        sprite_index = lsprite;
83
}
84
if (dsprite == spr_ralseid_ch1 && global.interact == 0 && fun == 0)
85
{
86
    distfrommcx = obj_mainchara_ch1.x - (x + 4);
87
    distfrommcy = obj_mainchara_ch1.y - (y + 12);
88
    if (abs(distfrommcy) <= 10 && abs(distfrommcx) <= 16)
89
    {
90
        if (distfrommcx <= 0 && global.facing == 1)
91
            blushtimer += 1;
92
        if (distfrommcx >= 0 && global.facing == 3)
93
            blushtimer += 1;
94
    }
95
    else
96
    {
97
        blushtimer = 0;
98
    }
99
    if (blushtimer >= 300)
100
    {
101
        if (sprite_index == dsprite)
102
            sprite_index = dsprite_blush;
103
        if (sprite_index == rsprite)
104
            sprite_index = rsprite_blush;
105
        if (sprite_index == usprite)
106
            sprite_index = usprite_blush;
107
        if (sprite_index == lsprite)
108
            sprite_index = lsprite_blush;
109
    }
110
}
111
else
112
{
113
    blushtimer = 0;
114
}