Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_sneo_heartattack_old_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 (con == 0)
6
{
7
    if (movementstyle == 1)
8
        speed += (0.1 * heart_speed_scaling);
9
    if (movementstyle != 0)
10
        speed += (0.4 * heart_speed_scaling);
11
    var destination = 72 + random(10);
12
    if (movementstyle != 2)
13
        destination = 156;
14
    if (distance_to_point(xstart, ystart) > destination)
15
    {
16
        if (movementstyle == 2)
17
            con = 2;
18
        else
19
            speed = 0;
20
        shootcon = 1;
21
        if (movementstyle == 2)
22
            shoottimer = -10;
23
    }
24
}
25
if (con == 2)
26
{
27
    if (movementstyle == 1)
28
        speed -= (0.1 * heart_speed_scaling);
29
    if (movementstyle != 0)
30
        speed -= (0.6 * heart_speed_scaling);
31
    if (x > (xstart - 12))
32
    {
33
        attackcount -= 1;
34
        if (attackcount > 0)
35
        {
36
            x = xstart;
37
            con = 0;
38
            shootcon = 0;
39
            shoottimer = 0;
40
            speed *= -0.4;
41
            visible = false;
42
            alarm[0]
 = 2;
gml_Object_obj_sneo_heartattack_old_Alarm_0.gml

visible = true;
43
            direction = 162 + random(36);
44
        }
45
        else
46
        {
47
            instance_destroy();
48
            with (obj_sneo_heartattack_intro)
49
            {
50
                timer = 0;
51
                con = 1;
52
            }
53
        }
54
    }
55
}
56
if (con == 3)
57
{
58
    defeatedtimer++;
59
    image_index = 0;
60
    if (defeatedtimer == 1)
61
    {
62
        a = 0;
63
        repeat (12)
64
        {
65
            fx = instance_create(x, y, obj_sneo_heart_defeated_fx);
66
            fx.direction = a * 30;
67
            a++;
68
        }
69
    }
70
    if (defeatedtimer > 20 && defeatedtimer < 50)
71
    {
72
        x += ((xstart - x) * 0.1);
73
        y += ((ystart - y) * 0.1);
74
    }
75
    if (defeatedtimer > 50)
76
    {
77
        image_alpha -= 0.1;
78
        if (image_alpha < 0)
79
        {
80
            instance_destroy();
81
            with (obj_sneo_heartattack_intro)
82
            {
83
                timer = 0;
84
                con = 1;
85
            }
86
        }
87
    }
88
}
89
if (shootcon == 1)
90
{
91
    if (shoottimer == 0)
92
        image_index = 1;
93
    if (shoottimer == 2)
94
        image_index = 0;
95
    if (shoottimer == 4)
96
        image_index = 1;
97
    if (shoottimer == 6)
98
        image_index = 0;
99
    shoottimer++;
100
    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))
101
    {
102
        var angle = 0 + rand_angle;
103
        if (shoottimer == obj_spamton_neo_enemy.heart_2nd_wave_timer)
104
            angle = 14 + rand_angle;
105
        repeat (10)
106
        {
107
            bullet = instance_create(x, y, obj_sneo_heatattack_bullet);
108
            bullet.image_angle = 0 + angle;
109
            bullet.direction = 0 + angle;
110
            bullet.gravity_direction = 0 + angle;
111
            bullet.image_xscale = obj_spamton_neo_enemy.heart_bullet_image_scale;
112
            bullet.image_yscale = obj_spamton_neo_enemy.heart_bullet_image_scale;
113
            bullet.depth = depth - 1;
114
            if (shoottimer == obj_spamton_neo_enemy.heart_1st_wave_timer)
115
            {
116
                bullet.speed = obj_spamton_neo_enemy.heart_bullet_speed_1st_wave;
117
                bullet.gravity = obj_spamton_neo_enemy.heart_bullet_friction_1st_wave;
118
            }
119
            if (shoottimer == obj_spamton_neo_enemy.heart_2nd_wave_timer)
120
            {
121
                bullet.speed = obj_spamton_neo_enemy.heart_bullet_speed_2nd_wave;
122
                bullet.gravity = obj_spamton_neo_enemy.heart_bullet_friction_2nd_wave;
123
            }
124
            if (shoottimer == obj_spamton_neo_enemy.heart_3rd_wave_timer)
125
            {
126
                bullet.speed = obj_spamton_neo_enemy.heart_bullet_speed_3rd_wave;
127
                bullet.gravity = obj_spamton_neo_enemy.heart_bullet_friction_3rd_wave;
128
            }
129
            angle += 36;
130
        }
131
    }
132
    if (shoottimer > 23)
133
    {
134
        shootcon = 0;
135
        con = 2;
136
        shoottimer = 0;
137
        rand_angle = random(40);
138
    }
139
}
140
if (heart_health < 1)
141
    exit;
142
if (difficulty > 0)
143
    bustertimer++;
144
if (bustertimer == obj_spamton_neo_enemy.heart_variant_arm_shoot_timer)
145
{
146
    with (obj_spamton_neo_enemy)
147
    {
148
        partmode = 3;
149
        armangle = point_direction(partxoff[1], partyoff[1], obj_heart.x, obj_heart.y);
150
        aimmode = 2;
151
        armaim = armangle;
152
        d = instance_create(x, y, obj_sneo_biglaser);
153
        d.direction = armangle - 90;
154
        d.image_angle = armangle - 90;
155
        d.depth += 1;
156
        d.damage = damage * 2;
157
    }
158
}
159
if (bustertimer == 150)
160
{
161
    with (obj_sneo_biglaser)
162
        instance_destroy();
163
    aimmode = 0;
164
    obj_spamton_neo_enemy.partmode = 4;
165
}
166
if (bustertimer > 150)
167
{
168
    with (obj_spamtonshot)
169
        dontexplode = 1;
170
}
171
if (bustertimer == 180)
172
    obj_spamton_neo_enemy.partmode = 1;
173
if (bustertimer == 263 && difficulty == 2)
174
{
175
    obj_spamton_neo_enemy.partmode = 1;
176
    instance_create(x, y, obj_sneo_guymaker);
177
}
178
if (bustertimer == 283 && difficulty == 2)
179
{
180
    with (obj_sneo_guymaker)
181
        instance_destroy();
182
}