Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_gerson_growtangle_Draw_0

(view raw script w/o annotations or w/e)
1
if (global.turntimer < 1)
2
{
3
    instance_destroy();
4
    exit;
5
}
6
if (con == 0)
7
{
8
    timer++;
9
    if (timer == 2)
10
    {
11
        anim = instance_create(obj_heart.x + 40, obj_heart.y - 10, obj_animation);
12
        anim.sprite_index = spr_gerson_swing;
13
        anim.image_speed = 0.5;
14
        anim.image_index = 0;
15
        anim.image_xscale = 2;
16
        anim.image_yscale = 2;
17
    }
18
    if (timer == 9)
19
    {
20
        with (obj_heart)
21
        {
22
            color = c_black;
23
            sprite_index = spr_heart;
24
            inst = instance_create(obj_heart.x, obj_heart.y, obj_gerson_fakeheart);
25
            inst.directionhit = 180;
26
            inst.speed = 15.6;
27
        }
28
        instance_create(x, y, obj_shake);
29
        snd_play(snd_screenshake);
30
    }
31
    if (timer > 11)
32
    {
33
        var xx;
34
        if (i_ex(obj_gerson_fakeheart))
35
            xx = obj_gerson_fakeheart.x;
36
        else
37
            xx = obj_heart.x;
38
        x1 = xx - 30;
39
        if (x1 < (camerax() + 50))
40
            x1 = camerax() + 50;
41
    }
42
    if (timer == 35)
43
    {
44
        timer = 0;
45
        con = 1;
46
        xxprev = obj_gerson_fakeheart.x;
47
    }
48
}
49
if (con == 1)
50
{
51
    timer++;
52
    if ((timer % 20) == 0 && obj_heart.x < (x2 - 80))
53
    {
54
        gers = instance_create(obj_heart.x + 20, y1 + 20, obj_gerson_swing_down_new);
55
        if (gers.x > (camerax() + 260))
56
            gers.x = camerax() + 260;
57
    }
58
    var xx;
59
    if (i_ex(obj_gerson_fakeheart))
60
        xx = obj_gerson_fakeheart.x;
61
    else
62
        xx = obj_heart.x;
63
    if (xxprev < xx)
64
        y1 += 2;
65
    if (xxprev < xx)
66
        xxprev = xx;
67
    if (y1 > (cameray() + 250))
68
        y1 = cameray() + 250;
69
    x1 = xx - 30;
70
    if (x1 < (camerax() + 50))
71
        x1 = camerax() + 50;
72
    if (obj_heart.x > (x2 - 50) && timer > 30)
73
    {
74
        timer = 0;
75
        con = 2;
76
    }
77
}
78
if (con == 2)
79
{
80
    obj_growtangle.x = obj_growtangle.xstart;
81
    obj_growtangle.image_alpha = 0;
82
    x1 = lerp(x1, obj_growtangle.x - (obj_growtangle.sprite_width / 2), 0.2);
83
    x2 = lerp(x2, obj_growtangle.x + (obj_growtangle.sprite_width / 2), 0.2);
84
    y1 = lerp(y1, obj_growtangle.y - (obj_growtangle.sprite_height / 2), 0.2);
85
    y2 = lerp(y2, obj_growtangle.y + (obj_growtangle.sprite_height / 2), 0.2);
86
    timer++;
87
    if (timer == 2)
88
    {
89
        snd_play(snd_smallswing);
90
        instance_create(x, y, obj_spearblocker);
91
    }
92
    if (timer == 20)
93
    {
94
        obj_growtangle.image_alpha = 1;
95
        instance_destroy();
96
    }
97
}
98
var colo = draw_get_color();
99
draw_set_colour(col);
100
d_line_width(x1, y1 - 1, x1, y2 + 2, 4);
101
d_line_width(x1, y1 + 1, x2, y1 + 1, 4);
102
d_line_width(x2, y1 - 1, x2, y2 + 2, 4);
103
d_line_width(x1, y2, x2, y2, 4);
104
draw_set_colour(colo);