Deltarune (Chapter 1) script viewer

← back to main script listing

gml_Object_obj_joker_body_Draw_0

(view raw script w/o annotations or w/e)
1
floatsiner += floatsinerspeed;
2
fly = sin(floatsiner / 8) * 3 * ((floatsinerspeed * 2) - 1);
3
flyx = 0;
4
if (dancelv >= 1)
5
    flyx = cos(floatsiner / 8) * 3 * ((floatsinerspeed * 2) - 1);
6
if (dancelv == 4)
7
{
8
    flyx = 0;
9
    fly = 0;
10
}
11
offx = x + 20;
12
offy = y + 18;
13
if (condition == 0)
14
{
15
    if (fade == 0)
16
        fade_a = 1;
17
    if (fade == 1)
18
        fade_a = abs(sin(floatsiner / 13));
19
    if (dancelv == 0)
20
        draw_sprite_ext(spr_joker_main, 0, offx + flyx, offy + fly, 2, 2, 0, c_white, fade_a);
21
    if (dancelv == 1)
22
        draw_sprite_ext(spr_joker_dance, floatsiner / 3, offx + flyx, offy + fly, 2, 2, 0, c_white, 1);
23
    if (dancelv == 2)
24
        draw_sprite_ext(spr_joker_tired, 0, offx + flyx, offy + fly, 2, 2, 0, c_white, 1);
25
    if (dancelv == 3)
26
    {
27
        dancesiner += 1;
28
        for (i = 0; i < 7; i += 1)
29
        {
30
            if (i >= 1)
31
            {
32
                shadowx[i] += sin(i + (floatsiner / 5)) * 8 * sfactor[i];
33
                shadowy[i] += cos(i + (floatsiner / 5)) * 4 * sfactor[i];
34
            }
35
            dalpha[i] = sin(i + (dancesiner / 9));
36
            if (dalpha[i] < 0 && i >= 1)
37
            {
38
                shadowx[i] = 60 - random(120);
39
                shadowy[i] = 60 - random(120);
40
                sfactor[i] = 1.5 - random(3);
41
            }
42
            draw_sprite_ext(spr_joker_dance, (dancesiner / 2) + (i / 4), x + shadowx[i], y + shadowy[i], 2, 2, 0, image_blend, dalpha[i]);
43
        }
44
    }
45
    if (dancelv == 4)
46
        draw_sprite_ext(spr_joker_teleport, 1, offx + flyx, offy + fly, 2, 2, 0, c_white, 1);
47
}
48
if (condition == 1)
49
{
50
    if (maxdist >= 150)
51
        maxdist = 150;
52
    sinadd = 0.8 + (maxdist / 50);
53
    if (sinadd < 0.8)
54
        sinadd = 0.8;
55
    if (sinadd > 2)
56
        sinadd = 2;
57
    siner += sinadd;
58
    sinx = sin(siner / 4) * maxdist;
59
    siny = -abs(sin(siner / 4)) * (maxdist * 0.7);
60
    ji = 0;
61
    if (sinx > (maxdist / 2) && maxdist > 15)
62
        ji = 1;
63
    if (sinx < (-maxdist / 2) && maxdist > 15)
64
        ji = 2;
65
    if (maxdist < 4)
66
        ji = 3;
67
    for (i = 0; i < (maxchain - 1); i += 1)
68
        draw_sprite_ext(spr_jokerchain, ji, (offx + (sinx * (i / maxchain))) - 2, offy + 6 + ((siny - 32) * (i / maxchain)) + fly, 2, 2, 0, c_white, 1);
69
    draw_sprite_ext(spr_jokerbody, 0, offx - 42, (offy + fly) - 2, 2, 2, 0, c_white, 1);
70
    draw_sprite_ext(spr_jokerhead, ji, (offx + sinx) - 2, (offy + siny + fly) - 14, 2, 2, 0, c_white, 1);
71
    maxdist -= 1;
72
    if (maxdist <= 0)
73
    {
74
        maxdist = 0;
75
        condition = 0;
76
    }
77
}
78
if (condition == 2)
79
{
80
    with (obj_heroparent)
81
        image_alpha -= 0.25;
82
    if (sndcon == 0)
83
    {
84
        snd_play(snd_spearappear);
85
        sndcon = 1;
86
    }
87
    draw_sprite_ext(spr_joker_main, 0, offx, offy + fly, size, 2, 0, c_white, 1);
88
    size -= 0.5;
89
    if (size <= 0)
90
    {
91
        with (obj_heroparent)
92
            image_alpha = 0;
93
        sndcon = 0;
94
        size = 2;
95
        condition = 4;
96
    }
97
}
98
if (condition == 3)
99
{
100
    with (obj_heroparent)
101
        image_alpha += 0.25;
102
    if (sndcon == 0)
103
    {
104
        snd_play(snd_spearappear);
105
        sndcon = 1;
106
    }
107
    draw_sprite_ext(spr_joker_main, 0, offx, offy + fly, size, 2, 0, c_white, 1);
108
    size += 0.5;
109
    if (size >= 2)
110
    {
111
        with (obj_heroparent)
112
            image_alpha = 1;
113
        size = 2;
114
        condition = 0;
115
        sndcon = 0;
116
    }
117
}
118
if (condition == 4)
119
{
120
    if (global.turntimer <= 10)
121
    {
122
        timer = 0;
123
        condition = 3;
124
        size = 0;
125
    }
126
}
127
if (condition == 5)
128
{
129
    timer += 1;
130
    if (timer == 1)
131
    {
132
        spintimer = 0;
133
        s_xscale = 2;
134
        s_yscale = 2;
135
        s_sprite = spr_joker_teleport;
136
        s_y = 0;
137
        s_vspeed = 0;
138
        s_alpha = 1;
139
        snd_play(scr_84_get_sound
scr_84_get_sound

function scr_84_get_sound(arg0) { return ds_map_find_value(global.chemg_sound_map, arg0); }
("snd_joker_metamorphosis"));
140
    }
141
    if (timer >= 1 && timer <= 3)
142
    {
143
        s_xscale *= 1.3;
144
        s_yscale *= 0.7;
145
    }
146
    if (timer >= 5 && timer <= 15)
147
    {
148
        s_xscale *= 0.7;
149
        s_yscale *= 1.3;
150
    }
151
    if (timer >= 15 && timer <= 30)
152
    {
153
        spintimer += 1;
154
        s_xscale = sin(spintimer / 3) * 2;
155
        s_sprite = spr_joker_scythebody;
156
        s_yscale *= 0.7;
157
        if (s_xscale >= 2)
158
            s_xscale = 2;
159
        if (s_yscale <= 2)
160
            s_yscale = 2;
161
    }
162
    if (timer >= 30 && timer < 41)
163
    {
164
        spintimer += 1;
165
        s_xscale = sin(spintimer / 3) * 2;
166
        s_vspeed -= 3;
167
        s_y += s_vspeed;
168
        s_alpha -= 0.1;
169
    }
170
    if (timer >= 41)
171
    {
172
        if (instance_exists(obj_battlecontroller))
173
        {
174
            if (global.turntimer > 10)
175
            {
176
                timer = 0;
177
                condition = 4;
178
            }
179
        }
180
    }
181
    draw_sprite_ext(s_sprite, 0, offx, offy + s_y, s_xscale, s_yscale, 0, image_blend, s_alpha);
182
}
183
if (condition == 0 || condition == 1)
184
{
185
    if (dancelv <= 2)
186
    {
187
        draw_set_color(c_black);
188
        draw_rectangle(((x + (sprite_width / 2)) - 20 - fly) + flyx, (y + 80) - (fly / 2), x + (sprite_width / 2) + 30 + fly + flyx, y + 85 + (fly / 2), false);
189
    }
190
}