Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_gerson_hammer_bro_attack_controller_Other_10

(view raw script w/o annotations or w/e)
1
timer++;
2
if (timer == throwsframes)
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, y + 90, 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.8 - random(4);
17
        if (y < (ystart + 50))
18
            bulletshot.fakehspeed = -2 - random(4);
19
        bulletshot.fakevspeed = -14;
20
        bulletshot.gravity_direction = 270;
21
        bulletshot.fakegravity = 0.6;
22
        bulletshot.depth = depth - 1;
23
        bulletshot.target = 3;
24
        bulletshot.damage = 1;
25
        bulletshot.grazed = 0;
26
        if (pattern == 1)
27
            bulletshot.fakehspeed = -2.8 - (count / 3.5);
28
        if (pattern == 2)
29
            bulletshot.fakehspeed = -6.8 + (count / 3);
30
        if ((pattern == 0 && (count == 2 || count == 4 || count == 6)) || count == 2 || count == 4)
31
        {
32
            if (obj_heart.x < (obj_growtangle.x - 37.5))
33
                bulletshot.fakehspeed = -4.8 - random(2);
34
            else if (obj_heart.x > (obj_growtangle.x + 37.5))
35
                bulletshot.fakehspeed = -2 - random(1.5);
36
            else if (obj_heart.x < obj_growtangle.x)
37
                bulletshot.fakehspeed = -3.7 - random(1.5);
38
            else if (obj_heart.x > obj_growtangle.x)
39
                bulletshot.fakehspeed = -2.7 - random(2.2);
40
        }
41
    }
42
    image_index = 1;
43
}
44
if (timer == (throwsframes * 2))
45
{
46
    image_index = 0;
47
    count++;
48
    if (pausecount >= count)
49
    {
50
        timer = -10;
51
        count = 0;
52
        throwsframes = 1;
53
        alarm[0]
 = 20;
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; }
54
    }
55
    else
56
    {
57
        timer = 0;
58
    }
59
}
60
if (vspeed == 0)
61
{
62
    jumptimer++;
63
    if (jumptimer == jumptimermax)
64
    {
65
    }
66
}
67
if (vspeed > 0 && y >= (ystart + 92))
68
{
69
    vspeed = 0;
70
    gravity = 0;
71
    y = ystart + 100;
72
}
73
lerpdowntimer++;
74
if (lerpdowntimer < 20)
75
    y = lerp(y, ystart + 100, lerpdowntimer / 20);
76
if (lerpdowntimer >= (attackduration - 20))
77
    y = lerp(y, ystart, (lerpdowntimer - (attackduration - 20)) / 20);
78
if (global.turntimer < 1 || lerpdowntimer == attackduration)
79
    instance_destroy();