Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_bush_leaf_alt_Step_0

(view raw script w/o annotations or w/e)
1
if (!init)
2
{
3
    if (side == 0)
4
        side = randomsign();
5
    targetx = xstart;
6
    xstart += (random_range(20, 10) * side);
7
    init = true;
8
}
9
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
(-20);
10
if (image_alpha < 1)
11
    image_alpha = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(image_alpha, 1, 0.25);
12
if (timer < lifetime)
13
{
14
    timer++;
15
    height = lerp(0, target_height, 
scr_ease_in
scr_ease_in

function
scr_ease_in(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_in_bounce(arg0, 0, 1, 1); case -2: return ease_in_elastic(arg0, 0, 1, 1); case -1: var _s = 1.70158; return arg0 * arg0 * (((_s + 1) * arg0) - _s); case 0: return arg0; case 1: return -cos(arg0 * 1.5707963267948966) + 1; case 6: return power(2, 10 * (arg0 - 1)); case 7: return -(sqrt(1 - sqr(arg0)) - 1); default: return power(arg0, arg1); } }
(timer / lifetime, 2));
16
    x = lerp(xstart, targetx, timer / lifetime);
17
}
18
else
19
{
20
    image_speed = 0;
21
    image_index = 0;
22
}