Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_halo_bat_circle_Step_0

(view raw script w/o annotations or w/e)
1
if (!i_ex(obj_growtangle))
2
    exit;
3
if (global.turntimer < 1)
4
{
5
    instance_destroy();
6
    exit;
7
}
8
if (con == 0)
9
{
10
    animtimer++;
11
    if (animtimer == 10)
12
    {
13
        animtimer = 0;
14
        con = 1;
15
    }
16
    else
17
    {
18
        exit;
19
    }
20
}
21
if (con == 2 && animtimer < 10)
22
    animtimer++;
23
timer++;
24
move_factor = 
scr_approach_curve
scr_approach_curve

function
scr_approach_curve(arg0, arg1, arg2, arg3 = 0.1)
{ return
scr_approach(arg0, arg1, max(arg3, abs(arg1 - arg0) / arg2));
}
(move_factor, 0, 15);
25
targangle -= turnrate;
26
var xtarg, ytarg;
27
if (reset)
28
{
29
    con = 2;
30
    xtarg = xstart;
31
    ytarg = ystart;
32
}
33
else
34
{
35
    xtarg = obj_growtangle.x + lengthdir_x(targdist, targangle);
36
    ytarg = obj_growtangle.y + lengthdir_y(targdist, targangle);
37
}
38
if (con == 2)
39
    move_factor = 4;
40
x = 
scr_approach_curve
scr_approach_curve

function
scr_approach_curve(arg0, arg1, arg2, arg3 = 0.1)
{ return
scr_approach(arg0, arg1, max(arg3, abs(arg1 - arg0) / arg2));
}
(x, xtarg, move_factor);
41
y = 
scr_approach_curve
scr_approach_curve

function
scr_approach_curve(arg0, arg1, arg2, arg3 = 0.1)
{ return
scr_approach(arg0, arg1, max(arg3, abs(arg1 - arg0) / arg2));
}
(y, ytarg, move_factor);
42
if (timer == (timer_shoot - 10) && global.turntimer >= 28)
43
{
44
    flash_alpha = 1.4;
45
    snd_play_volume(snd_bell_bounce_short, 0.5);
46
}
47
if (i_ex(obj_heart))
48
{
49
    if (timer >= floor(timer_shoot / (1 + (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 1))) && global.turntimer >= 18)
50
    {
51
        snd_play(motor_swing_down);
52
        var dir = 
scr_at_player
scr_at_player

function
scr_at_player(arg0 = x, arg1 = y)
{ return point_direction(arg0, arg1, obj_heart.x + (obj_heart.sprite_width / 2), obj_heart.y + (obj_heart.sprite_height / 2)); }
(x, y);
53
        if (
scr_monsterpop
scr_monsterpop

function
scr_monsterpop()
{ return global.monster[0] + global.monster[1] + global.monster[2]; }
() == 1 && ((shoot_counter > 0 && irandom(2)) || shoot_counter > 2))
54
        {
55
            dir += choose(-35, -20, 20, 35);
56
            shoot_counter = -1;
57
        }
58
        
scr_fire_bullet
scr_fire_bullet

function
scr_fire_bullet(arg0, arg1, arg2, arg3, arg4, arg5 = -4, arg6 = 0, arg7 = false, arg8 = 87135)
{ var bullet; if (arg8 != 87135) bullet = instance_create_depth(arg0, arg1, arg8, arg2); else bullet = instance_create(arg0, arg1, arg2); with (bullet) { direction = arg3; speed = arg4; if (arg5 != -4) sprite_index = arg5; updateimageangle = arg6; if (arg6) image_angle = arg3; if (arg7) { with (other)
scr_bullet_inherit(other.id);
} } return bullet; } function scr_fire_bullet_colorize(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 = 0) { var bullet = instance_create(arg0, arg1, arg2); with (bullet) { direction = arg3; speed = arg4; sprite_index = arg5; image_blend = arg6; updateimageangle = arg7; if (arg7) image_angle = arg3; } return bullet; }
(x, y, obj_halo_bat_ring_bullet, dir, 7.5, spr_bullet_ring);
59
        with (obj_halo_bat_ring_bullet)
60
        {
61
            damage = other.damage;
62
            target = other.target;
63
            grazepoints = 4;
64
        }
65
        timer = 0;
66
        shoot_counter++;
67
    }
68
}
69
if (global.turntimer < 18 && !reset)
70
{
71
    reset = true;
72
    move_factor = 12;
73
}