Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_heartattack_Step_0

(view raw script w/o annotations or w/e)
1
if (shakex > 0)
2
    shakex--;
3
if (shakey > 0)
4
    shakey--;
5
if (global.turntimer < 51)
6
{
7
    global.turntimer = 50;
8
    attackcount = 0;
9
}
10
if (con == 0)
11
{
12
    if (difficulty == 1)
13
    {
14
        speed += (0.5 * heart_speed_scaling);
15
    }
16
    else if (difficulty == 2)
17
    {
18
        if (movementstyle == 1)
19
            speed += (0.1 * heart_speed_scaling);
20
        if (movementstyle != 0)
21
            speed += (0.4 * heart_speed_scaling);
22
    }
23
    else
24
    {
25
        if (movementstyle == 1)
26
            speed += (0.1 * heart_speed_scaling);
27
        if (movementstyle != 0)
28
            speed += (0.4 * heart_speed_scaling);
29
    }
30
    var destination = 70 + random(3);
31
    if (movementstyle != 2)
32
        destination = 152;
33
    if (distance_to_point(xstart, ystart) > destination)
34
    {
35
        if (movementstyle == 2)
36
            con = 2;
37
        else
38
            speed = 0;
39
        shootcon = 1;
40
        if (movementstyle == 2)
41
            shoottimer = -10;
42
    }
43
}
44
if (con == 2)
45
{
46
    if (difficulty == 1)
47
    {
48
        speed -= (0.3 * heart_speed_scaling);
49
    }
50
    else if (difficulty == 2)
51
    {
52
        if (movementstyle == 1)
53
            speed -= (0.1 * heart_speed_scaling);
54
        if (movementstyle != 0)
55
            speed -= (0.6 * heart_speed_scaling);
56
    }
57
    else
58
    {
59
        if (movementstyle == 1)
60
            speed -= (0.1 * heart_speed_scaling);
61
        if (movementstyle != 0)
62
            speed -= (0.6 * heart_speed_scaling);
63
    }
64
    if (x > (xstart - 12))
65
    {
66
        attackcount -= 1;
67
        if (attackcount > 0)
68
        {
69
            x = xstart;
70
            con = 2.1;
71
            shootcon = 0;
72
            shoottimer = 0;
73
            speed *= -0.4;
74
            visible = false;
75
            alarm[0]
 = 2;
gml_Object_obj_sneo_heartattack_Alarm_0.gml

visible = true; con = 0; x = xstart; y = ystart; shootcon = 0; shoottimer = 0; direction = 162 + random(36);
76
            if (difficulty == 2)
77
                alarm[0]
 = 58;
gml_Object_obj_sneo_heartattack_Alarm_0.gml

visible = true; con = 0; x = xstart; y = ystart; shootcon = 0; shoottimer = 0; direction = 162 + random(36);
78
            direction = 162 + random(36);
79
        }
80
        else
81
        {
82
            instance_destroy();
83
            with (obj_sneo_heartattack_intro)
84
            {
85
                timer = 0;
86
                con = 1;
87
            }
88
            with (obj_sneo_biglaser)
89
                instance_destroy();
90
            with (obj_rouxls_power_up_orb)
91
                instance_destroy();
92
        }
93
    }
94
}
95
if (con == 3)
96
{
97
    with (obj_sneo_guymaker)
98
        instance_destroy();
99
    with (obj_sneo_lilguy)
100
        instance_destroy();
101
    with (obj_sneo_heatattack_bullet)
102
        instance_destroy();
103
    with (obj_spamtonshot)
104
        instance_destroy();
105
    defeatedtimer++;
106
    image_index = 0;
107
    if (defeatedtimer == 1)
108
    {
109
        a = 0;
110
        repeat (12)
111
        {
112
            fx = instance_create(x, y, obj_sneo_heart_defeated_fx);
113
            fx.direction = a * 30;
114
            a++;
115
        }
116
    }
117
    if (defeatedtimer > 20 && defeatedtimer < 50)
118
    {
119
        x += ((xstart - x) * 0.1);
120
        y += ((ystart - y) * 0.1);
121
    }
122
    if (defeatedtimer > 50)
123
    {
124
        image_alpha -= 0.1;
125
        if (image_alpha < 0)
126
        {
127
            instance_destroy();
128
            with (obj_sneo_heartattack_intro)
129
            {
130
                timer = 0;
131
                con = 1;
132
            }
133
        }
134
    }
135
}
136
if (shootcon == 1)
137
{
138
    if (shoottimer == 0)
139
        image_index = 1;
140
    if (shoottimer == 2)
141
        image_index = 0;
142
    if (shoottimer == 4)
143
        image_index = 1;
144
    if (shoottimer == 6)
145
        image_index = 0;
146
    shoottimer++;
147
    if ((shoottimer == obj_spamton_neo_enemy.heart_1st_wave_timer && heart_health > 0) || (shoottimer == obj_spamton_neo_enemy.heart_2nd_wave_timer && heart_health > 0) || (shoottimer == obj_spamton_neo_enemy.heart_3rd_wave_timer && heart_health > 0))
148
    {
149
        var angle = 0 + rand_angle;
150
        if (shoottimer == obj_spamton_neo_enemy.heart_2nd_wave_timer)
151
            angle = 14 + rand_angle;
152
        repeat (10)
153
        {
154
            bullet = instance_create(x, y, obj_sneo_heatattack_bullet);
155
            bullet.image_angle = 0 + angle;
156
            bullet.direction = 0 + angle;
157
            bullet.gravity_direction = 0 + angle;
158
            bullet.image_xscale = obj_spamton_neo_enemy.heart_bullet_image_scale;
159
            bullet.image_yscale = obj_spamton_neo_enemy.heart_bullet_image_scale;
160
            bullet.depth = depth - 1;
161
            if (shoottimer == obj_spamton_neo_enemy.heart_1st_wave_timer)
162
            {
163
                bullet.speed = obj_spamton_neo_enemy.heart_bullet_speed_1st_wave;
164
                bullet.gravity = obj_spamton_neo_enemy.heart_bullet_friction_1st_wave;
165
            }
166
            if (shoottimer == obj_spamton_neo_enemy.heart_2nd_wave_timer)
167
            {
168
                bullet.speed = obj_spamton_neo_enemy.heart_bullet_speed_2nd_wave;
169
                bullet.gravity = obj_spamton_neo_enemy.heart_bullet_friction_2nd_wave;
170
            }
171
            if (shoottimer == obj_spamton_neo_enemy.heart_3rd_wave_timer)
172
            {
173
                bullet.speed = obj_spamton_neo_enemy.heart_bullet_speed_3rd_wave;
174
                bullet.gravity = obj_spamton_neo_enemy.heart_bullet_friction_3rd_wave;
175
            }
176
            angle += 36;
177
        }
178
    }
179
    if (shoottimer > 23)
180
    {
181
        shootcon = 0;
182
        con = 2;
183
        shoottimer = 0;
184
        rand_angle = random(40);
185
    }
186
}
187
if (heart_health < 1)
188
    exit;