Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_spamton_attack_mode_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (attack == 1)
4
        firingspeed = 25;
5
    else
6
        btimer = firingspeed - irandom(10);
7
    init = 1;
8
}
9
if (state == 0)
10
{
11
}
12
if (state == 1)
13
{
14
    if (reposition == 0)
15
    {
16
        reposition = 1;
17
        x -= pieceoffset_x;
18
        y -= pieceoffset_y;
19
    }
20
    timer++;
21
    if (timer >= 10)
22
    {
23
        timer = 0;
24
        state = 2;
25
    }
26
}
27
if (state == 2)
28
{
29
    timer++;
30
    btimer++;
31
    if (attack != 0)
32
        y = (ystart - pieceoffset_y) + (sin(timer / 10) * 50);
33
    if (btimer >= firingspeed && attack < 2)
34
    {
35
        if (attack == 0)
36
        {
37
            d = instance_create(x + mouthx, y + mouthy, obj_spamton_jumper);
38
            d.direction = 180;
39
            d.speed = 5;
40
            d.target = target;
41
            d.damage = damage;
42
            d.grazepoints = grazepoints;
43
            if (jumpy == 0)
44
            {
45
                d.jumper = 1;
46
                if (doublecount == 2)
47
                {
48
                    jumpy = 2;
49
                    doublecount = 0;
50
                }
51
                else
52
                {
53
                    jumpy = choose(1, 2, 2);
54
                    if (jumpy == 1)
55
                        doublecount++;
56
                    else
57
                        doublecount = 0;
58
                }
59
            }
60
            else
61
            {
62
                jumpy--;
63
            }
64
            if (flip)
65
                d.gravity = 0.12;
66
            else
67
                d.gravity = -0.19;
68
            flip = 1 - flip;
69
        }
70
        else
71
        {
72
            var attackstring = choose(stringsetloc(
$$DEALS$
"$$DEALS$", "obj_spamton_attack_mode_slash_Step_0_gml_69_0"
), stringsetloc(
$VALUES$
"$VALUES$", "obj_spamton_attack_mode_slash_Step_0_gml_69_1"
), stringsetloc(
$$REAL$$
"$$REAL$$", "obj_spamton_attack_mode_slash_Step_0_gml_69_2"
), stringsetloc(
$"CHEAP"
"$\"CHEAP\"", "obj_spamton_attack_mode_slash_Step_0_gml_69_3"
), stringsetloc(
$PRICES$
"$PRICES$", "obj_spamton_attack_mode_slash_Step_0_gml_69_4"
), stringsetloc(
BARGAIN$
"BARGAIN$", "obj_spamton_attack_mode_slash_Step_0_gml_69_5"
), stringsetloc(
$$49.998
"$$49.998", "obj_spamton_attack_mode_slash_Step_0_gml_69_6"
));
73
            if (attackstring == stringsetloc(
$VALUES$
"$VALUES$", "obj_spamton_attack_mode_slash_Step_0_gml_70_0"
) && irandom(19) == 0)
74
                attackstring = stringsetloc(
$VAULES$
"$VAULES$", "obj_spamton_attack_mode_slash_Step_0_gml_70_1"
);
75
            var xoff = mouthx;
76
            var falsetimer = sin(timer / 10) * 50;
77
            for (i = 0; i < string_length(attackstring); i++)
78
            {
79
                d = instance_create(x + xoff, ((y + mouthy) - 10) + (sin((timer + 20) / 10) * 50), obj_spamton_wordbullet);
80
                d.direction = 180;
81
                d.speed = 10;
82
                d.timer = -xoff / 2;
83
                d.offset = (y + mouthy) - 10 - d.ystart;
84
                d.mouthx = x + mouthx;
85
                d.creator = self;
86
                d.bulletletter = string_char_at(attackstring, i + 1);
87
                d.target = target;
88
                d.damage = damage;
89
                d.grazepoints = grazepoints;
90
                xoff += 15;
91
                d.type = made;
92
            }
93
            made = 1 - made;
94
        }
95
        btimer = 0;
96
    }
97
    else if (btimer >= firingspeed && attack == 2 && global.turntimer >= 40)
98
    {
99
        if (inhalesfx == 0)
100
        {
101
            inhalesfx = 1;
102
            snd_loop(snd_sneo_overpower);
103
            snd_pitch(snd_sneo_overpower, 3);
104
            snd_pitch_time(snd_sneo_overpower, 5, 30);
105
            snd_volume(snd_sneo_overpower, 0.5, 0);
106
        }
107
        effecttimer++;
108
        if ((effecttimer % 6) == 0)
109
        {
110
            for (i = 0; i < 3; i++)
111
            {
112
                d = instance_create(x + mouthx, y + mouthy, obj_rouxls_power_up_orb);
113
                d.direction = irandom(40) + (i * 40) + 120;
114
                d.distance_multiplier = 0.75;
115
                d.lifetime = 12;
116
                d.max_radius = 3;
117
                d.depth = depth - 1;
118
                d.image_blend = image_blend;
119
            }
120
        }
121
    }
122
    if (global.turntimer <= 30 && btimer > 8)
123
    {
124
        timer = 10;
125
        state = 3;
126
    }
127
}
128
if (state == 3)
129
{
130
    if (inhalesfx)
131
    {
132
        inhalesfx = 0;
133
        snd_stop(snd_sneo_overpower);
134
    }
135
    timer--;
136
    if (timer == 0)
137
    {
138
        image_index = 4;
139
        image_speed = -1;
140
        x = xstart;
141
        y = ystart;
142
        state = 4;
143
    }
144
}
145
if (state == 4)
146
{
147
    if (image_index <= 0)
148
        image_speed = 0;
149
}