Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_gerson_hammer_bro_attack_controller_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
if (timer == throwsframes && global.turntimer > 30 && lerpdowntimer < (attackduration - 20))
3
{
4
    snd_stop(snd_smallswing);
5
    snd_play_pitch(snd_smallswing, 1 + random(0.3));
6
    var rep = 1;
7
    var a = 0;
8
    repeat (rep)
9
    {
10
        bulletshot = instance_create((x + 100) - 42, (y + 90) - 86, obj_gerson_hammer_bro_hammer);
11
        with (bulletshot)
12
            
scr_bullet_init
scr_bullet_init

function
scr_bullet_init()
{ grazed = 0; grazetimer = 0; destroyonhit = 1; target = 0; inv = 60; damage = 10; element = 0; grazepoints = 1; timepoints = 1; active = 1; updateimageangle = 0; }
();
13
        bulletshot.active = 1;
14
        bulletshot.image_xscale = 2;
15
        bulletshot.image_yscale = 2;
16
        bulletshot.fakehspeed = -2 - random(4.8);
17
        bulletshot.fakevspeed = -14;
18
        bulletshot.gravity_direction = 270;
19
        bulletshot.fakegravity = 0.6;
20
        bulletshot.depth = depth - 1;
21
        bulletshot.target = 3;
22
        bulletshot.damage = 1;
23
        bulletshot.grazed = 0;
24
        bulletshot.grazepoints = 2.5;
25
        if (y < (ystart + 50))
26
            bulletshot.fakevspeed = -10;
27
        if (pattern == 1)
28
            bulletshot.fakehspeed = -2.8 - (count / 4);
29
        if (pattern == 2)
30
            bulletshot.fakehspeed = -6.8 + (count / 3);
31
        if (count == 2 || count == 4)
32
        {
33
            if (obj_heart.x < (obj_growtangle.x - 37.5))
34
                bulletshot.fakehspeed = -4.8 - random(2);
35
            else if (obj_heart.x > (obj_growtangle.x + 37.5))
36
                bulletshot.fakehspeed = -2 - random(1.5);
37
            else if (obj_heart.x < obj_growtangle.x)
38
                bulletshot.fakehspeed = -3.7 - random(1.5);
39
            else if (obj_heart.x > obj_growtangle.x)
40
                bulletshot.fakehspeed = -2.7 - random(2.2);
41
        }
42
    }
43
    if (throwsframes != 1)
44
    {
45
        bulletshot = instance_create((x + 100) - 42, (y + 90) - 86, obj_gerson_hammer_bro_hammer);
46
        with (bulletshot)
47
            
scr_bullet_init
scr_bullet_init

function
scr_bullet_init()
{ grazed = 0; grazetimer = 0; destroyonhit = 1; target = 0; inv = 60; damage = 10; element = 0; grazepoints = 1; timepoints = 1; active = 1; updateimageangle = 0; }
();
48
        bulletshot.active = 1;
49
        bulletshot.image_xscale = 2;
50
        bulletshot.image_yscale = 2;
51
        bulletshot.fakehspeed = -2 - random(4.8);
52
        bulletshot.fakevspeed = -12 - random(4);
53
        bulletshot.gravity_direction = 270;
54
        bulletshot.fakegravity = 0.6;
55
        bulletshot.depth = depth - 1;
56
        bulletshot.target = 3;
57
        bulletshot.damage = 1;
58
        bulletshot.grazed = 0;
59
        bulletshot.grazepoints = 2.5;
60
        if (y < (ystart + 50))
61
            bulletshot.fakevspeed = -10;
62
        if (count == 2 || count == 4)
63
        {
64
            if (obj_heart.x < (obj_growtangle.x - 37.5))
65
                bulletshot.fakehspeed = -4.8 - random(2);
66
            else if (obj_heart.x > (obj_growtangle.x + 37.5))
67
                bulletshot.fakehspeed = -2 - random(1.5);
68
            else if (obj_heart.x < obj_growtangle.x)
69
                bulletshot.fakehspeed = -3.7 - random(1.5);
70
            else if (obj_heart.x > obj_growtangle.x)
71
                bulletshot.fakehspeed = -2.7 - random(2.2);
72
        }
73
        bulletshot = instance_create((x + 100) - 42, (y + 90) - 86, obj_gerson_hammer_bro_hammer);
74
        with (bulletshot)
75
            
scr_bullet_init
scr_bullet_init

function
scr_bullet_init()
{ grazed = 0; grazetimer = 0; destroyonhit = 1; target = 0; inv = 60; damage = 10; element = 0; grazepoints = 1; timepoints = 1; active = 1; updateimageangle = 0; }
();
76
        bulletshot.active = 1;
77
        bulletshot.image_xscale = 2;
78
        bulletshot.image_yscale = 2;
79
        bulletshot.fakehspeed = -2 - random(4.8);
80
        bulletshot.fakevspeed = -12 - random(4);
81
        bulletshot.gravity_direction = 270;
82
        bulletshot.fakegravity = 0.6;
83
        bulletshot.depth = depth - 1;
84
        bulletshot.target = 3;
85
        bulletshot.damage = 1;
86
        bulletshot.grazed = 0;
87
        bulletshot.grazepoints = 2.5;
88
        if (y < (ystart + 50))
89
            bulletshot.fakevspeed = -10;
90
        if (count == 2 || count == 4)
91
        {
92
            if (obj_heart.x < (obj_growtangle.x - 37.5))
93
                bulletshot.fakehspeed = -4.8 - random(2);
94
            else if (obj_heart.x > (obj_growtangle.x + 37.5))
95
                bulletshot.fakehspeed = -2 - random(1.5);
96
            else if (obj_heart.x < obj_growtangle.x)
97
                bulletshot.fakehspeed = -3.7 - random(1.5);
98
            else if (obj_heart.x > obj_growtangle.x)
99
                bulletshot.fakehspeed = -2.7 - random(2.2);
100
        }
101
    }
102
    image_index = 1;
103
    timerb = 3;
104
}
105
if (timerb > 0)
106
    timerb--;
107
if (timerb == 1 && image_index == 1)
108
    image_index = 2;
109
if (timer == (throwsframes * 2))
110
{
111
    image_index = 0;
112
    count++;
113
    if (pausecount <= count)
114
    {
115
        count = 0;
116
        if (pattern > 0)
117
        {
118
            alarm[0]
 = 5;
gml_Object_obj_gerson_hammer_bro_attack_controller_Alarm_0.gml

count = 0; if (pattern == 0) pattern = choose(1, 2); else if (pattern == 1) pattern = choose(0, 2); else if (pattern == 2) pattern = choose(0, 1); if (pattern == 1 || pattern == 2) forcepattern++; else forcepattern = 0; if (forcepattern == 3) { forcepattern = 0; pattern = 0; } if (pattern > 0) { timer = -20; throwsframes = 1; if (forcepattern > 1) { timer = (5 + irandom(5)) * -1; throwsframes = 1; } } else { timer = 0; throwsframes = 6; }
119
            timer = -23;
120
        }
121
        else
122
        {
123
            timer = -11;
124
            alarm[0]
 = 30;
gml_Object_obj_gerson_hammer_bro_attack_controller_Alarm_0.gml

count = 0; if (pattern == 0) pattern = choose(1, 2); else if (pattern == 1) pattern = choose(0, 2); else if (pattern == 2) pattern = choose(0, 1); if (pattern == 1 || pattern == 2) forcepattern++; else forcepattern = 0; if (forcepattern == 3) { forcepattern = 0; pattern = 0; } if (pattern > 0) { timer = -20; throwsframes = 1; if (forcepattern > 1) { timer = (5 + irandom(5)) * -1; throwsframes = 1; } } else { timer = 0; throwsframes = 6; }
125
        }
126
    }
127
    else
128
    {
129
        timer = 0;
130
    }
131
}
132
if (con == 0 && pattern == 0)
133
{
134
    jumptimer++;
135
    if (jumptimer == jumptimermax)
136
    {
137
        if (con2 == 0)
138
        {
139
            startx = x;
140
            starty = y;
141
            targetx = x - 50;
142
            targety = y;
143
            con2 = 1;
144
        }
145
        else
146
        {
147
            startx = x;
148
            starty = y;
149
            targetx = x + 50;
150
            targety = y;
151
            con2 = 0;
152
        }
153
        jumptimer = 0;
154
        jumptimermax = 30 + irandom(12);
155
        con = 1;
156
        snd_play_pitch(snd_jump, 2);
157
    }
158
}
159
if (con == 1)
160
{
161
    jumptimer++;
162
    fakey = -15 + (sin(jumptimer / 7.4) * 100 * -1);
163
    x = lerp(startx, targetx, jumptimer / 24);
164
    y = lerp(starty, targety, jumptimer / 24);
165
    y += fakey;
166
    if (jumptimer == 24)
167
    {
168
        y = starty;
169
        con = 0;
170
        jumptimer = 0;
171
    }
172
}
173
if (vspeed > 0 && y >= (ystart + 84) && endtimer == 0)
174
{
175
    vspeed = 0;
176
    gravity = 0;
177
    y = ystart + 92;
178
}
179
if (vspeed > 0 && y >= (ystart - 10) && endtimer != 0)
180
{
181
    vspeed = 0;
182
    gravity = 0;
183
    y = ystart;
184
    instance_destroy();
185
}
186
lerpdowntimer++;
187
if (lerpdowntimer < 20)
188
{
189
    if (lerpdowntimer == 1)
190
    {
191
        snd_play_pitch(snd_jump, 2);
192
        vspeed = -14;
193
        gravity = 2;
194
    }
195
}
196
if (lerpdowntimer >= (attackduration - 20) && con == 0)
197
{
198
    image_index = 0;
199
    if (global.turntimer > 20)
200
        global.turntimer = 20;
201
    endtimer++;
202
    if (endtimer == 1)
203
    {
204
        snd_play_pitch(snd_jump, 2);
205
        vspeed = -20.6;
206
        gravity = 2;
207
    }
208
}
209
if (global.turntimer < 1)
210
    instance_destroy();