Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_overworld_lanternflame_arc_Step_0

(view raw script w/o annotations or w/e)
1
active = 0;
2
if (i_ex(obj_mainchara) && obj_mainchara.battlemode == 1)
3
    active = 1;
4
if (con == 0)
5
{
6
    timer++;
7
    if (timer % 2)
8
        visible = false;
9
    else
10
        visible = true;
11
    if (timer == 10)
12
    {
13
        timer = 0;
14
        con = 1;
15
        distancex = xstart - targetx;
16
        distancey = ystart - targety;
17
    }
18
    depth = -9999999999999;
19
}
20
if (con == 1)
21
{
22
    timer += 1;
23
    if (bouncy == 0)
24
    {
25
        x = lerp(xstart, targetx, timer / 60);
26
        y = lerp(ystart, targety, timer / 60);
27
        fakey = -15 + (sin(timer / 19) * 200 * -1);
28
        if (timer == 60)
29
        {
30
            depth = savedepth;
31
            timer = 0;
32
            con = 2;
33
        }
34
    }
35
    else
36
    {
37
        x = lerp(xstart, targetx, timer / 20);
38
        y = lerp(ystart, targety, timer / 20);
39
        fakey = -4 + (sin(timer / 7.1) * 100 * -1);
40
        if (timer == 20)
41
        {
42
            depth = savedepth;
43
            timer = 0;
44
            con = 2;
45
        }
46
    }
47
}
48
if (con == 2)
49
{
50
    timer++;
51
    if (bouncy == 0 && timer == 10)
52
        hitwall = 1;
53
    if (bouncy == 1 && timer == 1)
54
    {
55
        xstart = x;
56
        ystart = y;
57
        targetx -= distancex;
58
        targety -= distancey;
59
        timer = 0;
60
        con = 1;
61
    }
62
}
63
if (global.inv < 0 && obj_mainchara.battlemode == 1 && ((con == 2 && timer < 4) || (con == 1 && timer > 55) || (con == 1 && timer < 5)))
64
{
65
    if (collision_rectangle(x - 6, (y - 10) + fakey, x, y + 12 + fakey, obj_mainchara, true, true))
66
        event_user(5);
67
}
68
if (hitwall == 1)
69
{
70
    active = 0;
71
    speed = 0;
72
    image_xscale = lerp(image_xscale, -1, 0.07);
73
    image_yscale = lerp(image_yscale, -1, 0.07);
74
}
75
if (i_ex(mylight))
76
{
77
    mylight.smallerLight = 120 * image_alpha;
78
    mylight.biggerLight = mylight.smallerLight * 1.15;
79
}
80
if (active == 0)
81
    image_alpha = lerp(image_alpha, -1, 0.07);
82
if (image_alpha < 0)
83
    instance_destroy();
84
if (x < 0)
85
    instance_destroy();