Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_magic_book_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
timer++;
3
vspeed = 
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));
}
(vspeed, 0, 12);
4
hspeed = 
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));
}
(hspeed, 0, 10);
5
image_alpha = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(image_alpha, fadetarg, 0.08333333333333333);
6
if (timer == 8)
7
    image_index = 3;
8
if (timer == 12)
9
{
10
    if (dog)
11
        image_index = 7;
12
    else
13
        image_index = 4 + spell;
14
}
15
if (image_index > 3)
16
{
17
    if (spell == 0 && ((timer - 12) % (12 + ceil(9 * ratio))) == 6)
18
    {
19
        var lifetime = 25 + irandom(5);
20
        var bubble = 
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_bullet_bubble,
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) + random_range(-15, 15), 8 + random(4), spr_magic_book_bubble, false, false, depth - 1);
21
        bubble.alarm[0] = lifetime;
22
        bubble.damage = 80;
23
        bubble.target = 4;
24
        bubble.grazepoints = 3;
25
        
scr_lerpvar_instance
scr_lerpvar_instance

function
scr_lerpvar_instance()
{ __lerpvar = instance_create(0, 0, obj_lerpvar); __lerpvar.target = argument[0]; __lerpvar.varname = argument[1]; __lerpvar.pointa = argument[2]; __lerpvar.pointb = argument[3]; __lerpvar.maxtime = argument[4]; if (argument_count >= 6) __lerpvar.easetype = argument[5]; if (argument_count >= 7) __lerpvar.easeinout = argument[6]; return __lerpvar; } function scr_lerp_var_instance() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(bubble, "speed", bubble.speed / 2, 0.5, lifetime - 3);
26
        
scr_lerpvar_instance
scr_lerpvar_instance

function
scr_lerpvar_instance()
{ __lerpvar = instance_create(0, 0, obj_lerpvar); __lerpvar.target = argument[0]; __lerpvar.varname = argument[1]; __lerpvar.pointa = argument[2]; __lerpvar.pointb = argument[3]; __lerpvar.maxtime = argument[4]; if (argument_count >= 6) __lerpvar.easetype = argument[5]; if (argument_count >= 7) __lerpvar.easeinout = argument[6]; return __lerpvar; } function scr_lerp_var_instance() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7) return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else return
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(bubble, "speed", bubble.speed, 1.35, 11);
27
    }
28
    if (spell == 1)
29
    {
30
        if (timer == 20)
31
        {
32
            var offset = -40;
33
            while (offset <= 40)
34
            {
35
                with (
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_book_bullet,
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) + offset, 5, spr_magic_book_wind))
36
                {
37
                    with (obj_book_bullet)
38
                    {
39
                        damage = 80;
40
                        target = 4;
41
                        grazepoints = 3.5;
42
                    }
43
                }
44
                offset += (80 / (3 - (ratio > 1)));
45
            }
46
        }
47
        if (timer == 35)
48
        {
49
            var offset = -52;
50
            while (offset <= 52)
51
            {
52
                with (
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_book_bullet,
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) + offset, 5, spr_magic_book_wind))
53
                {
54
                    with (obj_book_bullet)
55
                    {
56
                        damage = 80;
57
                        target = 4;
58
                        grazepoints = 3.5;
59
                    }
60
                }
61
                offset += (104 / (4 - (ratio > 1)));
62
            }
63
        }
64
    }
65
    if (spell == 2)
66
    {
67
        if (timer == 16)
68
        {
69
            if (sameattack == 1 || boost || irandom(4) < 2)
70
            {
71
                xtarg = obj_heart.x + 10;
72
                ytarg = obj_heart.y + 10;
73
            }
74
            else
75
            {
76
                xtarg = (obj_growtangle.x - 75) + random(150);
77
                ytarg = (obj_growtangle.y - 75) + random(150);
78
            }
79
            flip = choose(180, 0);
80
        }
81
        if ((timer % 3) == 1 && timer >= 16 && timer < 32)
82
        {
83
            with (instance_create(x, y, obj_book_bullet))
84
            {
85
                sprite_index = spr_magic_book_fire;
86
                vspeed = 10;
87
                gravity_direction = 90;
88
                gravity = 0.5;
89
                hspeed = (other.xtarg - x) / 15;
90
                vspeed += ((other.ytarg - y) / ((2 * vspeed) / gravity));
91
                damage = 80;
92
                target = 4;
93
                grazepoints = 1.5;
94
                timepoints = 1;
95
                bottomfade = 0;
96
                wall_destroy = false;
97
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("hspeed", hspeed, 0, 30, 3);
98
            }
99
        }
100
        if (boost && timer > 38 && (timer % round(3)) == sameattacker)
101
        {
102
            var _y = ((ytarg + 100) - ((timer - 38) * 10)) + 11;
103
            if (_y < (obj_growtangle.y + 100) && _y > (obj_growtangle.y - 80))
104
            {
105
                with (
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; }
(xtarg, (_y + random(5)) - 10, obj_book_bullet, flip, 2, spr_rouxls_fire))
106
                {
107
                    image_angle = direction;
108
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("image_xscale", 0, 1, 9, 3);
109
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("x", x, x + (hspeed * 15), 18, 3);
110
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpvar_respect() { if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
___lerpvar.respectglobalinteract = true; return ___lerpvar; }
("hspeed", 0, hspeed * 5, 30, 3);
111
                    image_xscale = 0;
112
                    other.flip += 180;
113
                    damage = 80;
114
                }
115
            }
116
        }
117
        with (obj_book_bullet)
118
        {
119
            if (vspeed < -12)
120
                vspeed = -12;
121
        }
122
        if (timer == 32 && !boost)
123
            timer = 50;
124
    }
125
}
126
if (timer == (50 + (15 * boost)))
127
{
128
    image_index = 3;
129
    depth++;
130
}
131
if (timer == (54 + (15 * boost)))
132
    image_index = spell;
133
if (timer == (60 + (15 * boost)))
134
{
135
    vspeed = -10;
136
    hspeed = 4 * open_side;
137
    fadetarg = 0;
138
}
139
if (image_index > 2)
140
    image_xscale = open_side;