Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_pipisFireworkGenerator_Step_0

(view raw script w/o annotations or w/e)
1
with (obj_caterpillarchara)
2
{
3
    if (image_alpha <= 0)
4
        visible = false;
5
    else
6
        visible = true;
7
}
8
if (con == 0)
9
{
10
    with (obj_caterpillarchara)
11
    {
12
        if (image_alpha != 1)
13
            image_alpha = lerp(image_alpha, 1, 0.125);
14
    }
15
    if (obj_mainchara.battlemode == 1)
16
    {
17
        con = 1;
18
        timer = 0;
19
    }
20
    if (i_ex(obj_overworldbullet_fireworks))
21
    {
22
        with (obj_overworldbullet_fireworks)
23
        {
24
            image_alpha = lerp(image_alpha, 0, 0.25);
25
            if (image_alpha == 0)
26
                instance_destroy();
27
            timer = 0;
28
        }
29
    }
30
    if (i_ex(obj_overworldbulletparent))
31
    {
32
        with (obj_overworldbulletparent)
33
        {
34
            image_alpha = lerp(image_alpha, 0, 0.25);
35
            if (image_alpha == 0)
36
                instance_destroy();
37
            timer = 0;
38
        }
39
    }
40
}
41
if (con == 1)
42
{
43
    with (obj_caterpillarchara)
44
    {
45
        if (image_alpha != 0)
46
            image_alpha = lerp(image_alpha, 0, 0.3);
47
    }
48
    timer++;
49
    if (timer >= 20)
50
    {
51
        py = cameray() + random_range(0, 120);
52
        py = clamp(py, 360, 2920);
53
        py = clamp(py, cameray(), 2920);
54
        if ((shotcount % 2) == 0)
55
            px = random_range(-20, -40);
56
        else
57
            px = random_range(room_width + 20, room_width + 40);
58
        pipis = instance_create(px, py, obj_overworldbullet_fireworks);
59
        pipis.depth = depth - 50;
60
        shotcount++;
61
        timer = random_range(-5, 5);
62
    }
63
    if (obj_mainchara.battlemode == 0)
64
    {
65
        con = 0;
66
        timer = 0;
67
    }
68
}