Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_hangplug_Step_0

(view raw script w/o annotations or w/e)
1
siner += 1;
2
depth = 9000;
3
y = basey + (sin(siner / 70) * 3);
4
if (obj_mainchara.x >= (x - radius) && obj_mainchara.x <= (x + radius))
5
    active = 1;
6
else
7
    active = 0;
8
if (active == 0)
9
{
10
    image_speed = 0;
11
    image_index = 0;
12
}
13
if (active == 1 && decorative == 0)
14
{
15
    if (con == 0)
16
    {
17
        timer += 1;
18
        if (obj_mainchara.x != obj_mainchara.xprevious)
19
            timer += 1;
20
        if (timer >= chargetime && x >= camerax() && x <= ((camerax() + 640) - sprite_width))
21
        {
22
            con = 1;
23
            image_speed = 0.25;
24
            timerb = 0;
25
        }
26
    }
27
    if (con == 1)
28
    {
29
        timerb += 1;
30
        timerbtarget = 15;
31
        if (room == room_dw_mansion_east_4f_c)
32
            timerbtarget = 8;
33
        if (timerb == timerbtarget)
34
        {
35
            if (!snd_is_playing(snd_spearappear))
36
            {
37
                spawn = snd_play(snd_spearappear);
38
                snd_volume(spawn, 0.6, 0);
39
            }
40
            image_index = 0;
41
            image_speed = 0;
42
            timerb = 0;
43
            con = 0;
44
            timer = random(chargetime / 2) - 30;
45
            spark = instance_create(basex + 22, basey + 190, obj_hangplug_spark);
46
            spark.depth = depth - 1;
47
        }
48
    }
49
}