Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_bullet_dice_Step_0

(view raw script w/o annotations or w/e)
1
event_inherited();
2
image_angle += rot_speed;
3
if (abs((x + hspeed) - obj_growtangle.x) > 65)
4
{
5
    rot_speed *= -0.8;
6
    hspeed *= -0.9;
7
    x += hspeed;
8
}
9
if (decel == -1)
10
{
11
    vspeed = 
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; }
(vspeed, max_speed, 0.4);
12
}
13
else if (decel > 0)
14
{
15
    speed = 
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));
}
(speed, 0, decel);
16
    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, sqr(decel));
17
    rot_speed = 
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));
}
(rot_speed, 0, decel);
18
    decel--;
19
    if (decel == 10)
20
        queue_lock = true;
21
    if (decel == 0)
22
    {
23
        if (alarm[1] == -1)
24
            alarm[1]
 = 20;
gml_Object_obj_bullet_dice_Alarm_1.gml

image_index = floor(image_index); var pips = image_index / 4; if (sprite_index == spr_bullet_dice_all4s) pips = 3; event_user(0); with (instance_create(x, y, obj_regularbullet)) { image_blend = c_gray; sprite_index = other.sprite_index; image_xscale = other.image_xscale; image_yscale = other.image_yscale; image_angle = other.image_angle; image_index = other.image_index; image_blend = other.image_blend; image_speed = 0; mask_index = spr_nothing; active = false; grazed = true;
scr_lerpvar("image_xscale", image_xscale, 3, 5);
scr_lerpvar("image_yscale", image_yscale, 3, 5);
scr_lerpvar("image_alpha", image_yscale, 0, 5);
} bullet = instance_create(x, y, obj_bullet_dice_shockwave); bullet.target = target; bullet.damage = 40; bullet.grazepoints = 4; bullet.count = 0; bullet.image_xscale = 1.5; bullet.image_yscale = 1.5; if (pips >= 3 || (sprite_index == spr_bullet_dice && image_index >= 8) || (sprite_index == spr_bullet_dice4pip && image_index >= 8)) { bullet.image_xscale = 2; bullet.image_yscale = 2; }
25
        decel = -2;
26
    }
27
}
28
if ((y + vspeed) > (obj_growtangle.y + 58) && vspeed > 0)
29
{
30
    vspeed *= choose(-0.3, -0.6, -0.8, -1);
31
    if (decel == -1)
32
        decel = 15;
33
    snd_play(snd_bump);
34
}
35
if ((mercified && sprite_index == spr_bullet_dice_all4s) || (mercified && image_index >= 10 && image_index < 15 && sprite_index == spr_bullet_dice4pip))
36
    mask_index = spr_bullet_dice_6;
37
else
38
    mask_index = spr_bullet_dice4pip;