Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_elnina_bouncingbullet_Step_0

(view raw script w/o annotations or w/e)
1
if (image_alpha < 1)
2
    image_alpha += 0.1;
3
var touchedbottom = 0;
4
if (forceminigametocontinue)
5
    obj_tenna_zoom.minigameinsanitytimer = obj_tenna_zoom.minigameinsanitytimermax - 2;
6
var bottomy;
7
if (i_ex(obj_growtangle))
8
{
9
    var _sprite_width = 150;
10
    var _sprite_height = 150;
11
    var width = sprite_width / 4;
12
    var leftx = (obj_growtangle.x - (_sprite_width / 2)) + width;
13
    var rightx = (obj_growtangle.x + (_sprite_width / 2)) - width;
14
    bottomy = (obj_growtangle.y + (_sprite_height / 2)) - (sprite_height / 2);
15
    if (x < leftx)
16
    {
17
        hspeed = abs(hspeed);
18
        x += 2;
19
    }
20
    if (x > rightx)
21
    {
22
        hspeed = -abs(hspeed);
23
        x -= 2;
24
    }
25
    if (y > bottomy)
26
    {
27
        vspeed = -abs(vspeed) * 1.5;
28
        y -= 2;
29
        forceminigametocontinue = false;
30
        touchedbottom = 1;
31
    }
32
    x = clamp(x, leftx, rightx);
33
}
34
if (vspeed < 8)
35
    vspeed += 0.5;
36
if (abs(hspeed) > 6)
37
    hspeed *= 0.95;
38
bounce_buffer--;
39
if (touchedbottom && image_blend != c_ltgray)
40
{
41
    if (difficulty >= 2)
42
    {
43
        snd_stop(snd_error);
44
        snd_play_x(snd_error, 0.6, 2);
45
        snd_play_x(snd_error, 0.6, 1.5 + random(0.2));
46
        var angleoffset = random_range(-20, 20);
47
        var bulletamount = 5;
48
        var baseangle = 90;
49
        var spread = 42;
50
        for (var i = 0; i < bulletamount; i++)
51
        {
52
            var mybullet = instance_create(x, bottomy + 8, obj_regularbullet);
53
            mybullet.sprite_index = spr_shutta_lightning;
54
            mybullet.speed = 1;
55
            mybullet.friction = -0.1;
56
            mybullet.depth = depth + 10;
57
            mybullet.direction = (baseangle - (spread * 2)) + (spread * i) + angleoffset;
58
            mybullet.image_angle = mybullet.direction;
59
            mybullet.image_speed = 0.25;
60
            mybullet.image_yscale = 0.5;
61
            scr_lerp_var_instance(mybullet, "image_alpha", 5, 0, 60, 0);
62
            with (mybullet)
63
                
scr_var_delay
scr_var_delay

function
scr_var_delay(arg0, arg1, arg2)
{
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_var_delayed(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
} function scr_delay_var(arg0, arg1, arg2) {
scr_script_delayed(scr_var, arg2, arg0, arg1);
}
("active", 0, 50);
64
            
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(mybullet, 60);
65
            
scr_bullet_inherit
scr_bullet_inherit

function
scr_bullet_inherit(arg0)
{ if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; if (object_index == obj_dbulletcontroller) { arg0.creatorid = creatorid; arg0.creator = creator; } arg0.element = element; } }
(mybullet);
66
        }
67
        var shrinkmarker = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(x, bottomy + 8, spr_ball_30);
68
        shrinkmarker.depth = depth + 9;
69
        shrinkmarker.image_xscale = 1;
70
        shrinkmarker.image_yscale = 1;
71
        
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(shrinkmarker, 20);
72
        
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)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(shrinkmarker, "image_xscale", 1, 0, 20, -1, "out");
73
        
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)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
} function scr_lerp_instance_var() { if (argument_count >= 6)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5);
else if (argument_count >= 7)
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4, argument5, argument6);
else
scr_lerpvar_instance(argument0, argument1, argument2, argument3, argument4);
}
(shrinkmarker, "image_yscale", 1, 0, 20, -1, "out");
74
    }
75
}
76
if (difficulty == 3)
77
{
78
    if (instance_number(object_index) < 2)
79
    {
80
        if (bounce_count < 56)
81
        {
82
            var newball = instance_create(obj_growtangle.x, cameray() + 20, object_index);
83
            newball.depth = depth + 1;
84
            newball.difficulty = 3;
85
            
scr_bullet_inherit
scr_bullet_inherit

function
scr_bullet_inherit(arg0)
{ if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; if (object_index == obj_dbulletcontroller) { arg0.creatorid = creatorid; arg0.creator = creator; } arg0.element = element; } }
(newball);
86
        }
87
    }
88
    if (instance_number(object_index) < 3)
89
    {
90
        if (bounce_count < 36)
91
        {
92
            var newball = instance_create(obj_growtangle.x, cameray() + 20, object_index);
93
            newball.depth = depth + 1;
94
            newball.difficulty = 0;
95
            newball.image_blend = c_ltgray;
96
            
scr_bullet_inherit
scr_bullet_inherit

function
scr_bullet_inherit(arg0)
{ if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; if (object_index == obj_dbulletcontroller) { arg0.creatorid = creatorid; arg0.creator = creator; } arg0.element = element; } }
(newball);
97
        }
98
    }
99
}
100
if (difficulty == 2)
101
{
102
    if (instance_number(object_index) < 2)
103
    {
104
        if (bounce_count < 10)
105
        {
106
            var newball = instance_create(obj_growtangle.x, cameray() + 20, object_index);
107
            newball.depth = depth + 1;
108
            newball.difficulty = 0;
109
            newball.image_blend = c_ltgray;
110
            
scr_bullet_inherit
scr_bullet_inherit

function
scr_bullet_inherit(arg0)
{ if (i_ex(arg0)) { if (damage != -1) arg0.damage = damage; if (grazepoints != -1) arg0.grazepoints = grazepoints; if (timepoints != -1) arg0.timepoints = timepoints; if (inv != -1) arg0.inv = inv; if (target != -1) arg0.target = target; if (grazed != -1) arg0.grazed = 0; if (grazetimer != -1) arg0.grazetimer = 0; if (object_index == obj_dbulletcontroller) { arg0.creatorid = creatorid; arg0.creator = creator; } arg0.element = element; } }
(newball);
111
        }
112
    }
113
}