Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_lastattack_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    remx = x;
4
    movetimer++;
5
    init = 1;
6
}
7
if (con == 0)
8
{
9
    movetimer++;
10
    if (movetimer <= 14)
11
    {
12
        y = lerp(y, yspot[ycurrent], 0.122);
13
    }
14
    else
15
    {
16
        movetimer = 0;
17
        count++;
18
        ycurrent++;
19
        if (ycurrent >= 2)
20
            ycurrent = 0;
21
    }
22
    shottimer++;
23
    if (shottimer >= choose(15))
24
    {
25
        lastshoty = y;
26
        bigshot = instance_create(x + 100, y + y_offset, obj_sneo_bigshot);
27
        bigshot.hspeed = -6;
28
        bigshot.friction = -0.25;
29
        shottimer = 0 + (count / 4);
30
        shotmouthopen = 1;
31
        shotmouthopentimer = 0;
32
        rand = 70 + irandom(5);
33
        snd_play_x(snd_chargeshot_fire, 0.75, 0.7);
34
    }
35
    if (count == 10 || endattack == 1)
36
    {
37
        con = 1;
38
        timer = 0;
39
        endattack = 1;
40
    }
41
}
42
if (shotmouthopen == 1)
43
{
44
    shotmouthopentimer++;
45
    mouthtopy = -sin(shotmouthopentimer / 3) * 30;
46
    mouthbottomy = -mouthtopy;
47
    mouthangle = mouthtopy;
48
    if (mouthbottomy < 0)
49
    {
50
        mouthangle = 0;
51
        mouthtopy = 0;
52
        mouthbottomy = 0;
53
        shotmouthopentimer = 0;
54
        shotmouthopen = 0;
55
    }
56
}
57
if (con == 1)
58
{
59
    timer++;
60
    y = lerp(y, (yspot[0] + yspot[1]) / 2, 0.1);
61
    if (timer < 10)
62
    {
63
        mouthbottomy = lerp(mouthbottomy, 0, 0.2);
64
        mouthtopy = lerp(mouthtopy, 20, 0.2);
65
    }
66
    if (timer >= 10 && timer < 25)
67
    {
68
        mouthbottomy = lerp(mouthbottomy, 120, 0.04);
69
        mouthtopy = lerp(mouthtopy, -100, 0.04);
70
        mouthangle = lerp(mouthangle, -45, 0.05);
71
    }
72
    if (timer >= 10)
73
    {
74
        mouthtopy += (sin(timer * 2) * 4);
75
        mouthbottomy -= (sin(timer * 2) * 4);
76
        mouthangle -= (sin(timer) * 5);
77
        x += random_range(-1, 1);
78
        y += random_range(-1, 1);
79
    }
80
    if (timer == 11)
81
    {
82
        bigshot = instance_create(x + 131, y + y_offset, obj_sneo_bigshot);
83
        bigshot.image_xscale = 0;
84
        bigshot.image_yscale = 0;
85
        bigshot.sprite_index = spr_sneo_bigshot_l;
86
        shottimer = 0;
87
        snd_play_x(snd_chargeshot_fire, 0.7, 0.4);
88
        snd_play_x(snd_chargeshot_fire, 0.7, 0.6);
89
        snd_play_x(snd_chargeshot_fire, 0.7, 0.8);
90
        snd_play_x(snd_chargeshot_fire, 0.7, 0.9);
91
    }
92
}