Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_cliff_crater_windtrail_Step_0

(view raw script w/o annotations or w/e)
1
if (!init)
2
    init = true;
3
distance = lerp(100, 30, 1 - 
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); } }
(lifetime / max_lifetime, 2));
4
var _psuedo_depth = 0;
5
if (lifetime > 0)
6
{
7
    x = xstart + lengthdir_x(distance, direction);
8
    _psuedo_depth = lengthdir_y(distance, direction);
9
    if (draw_foreground)
10
    {
11
        if (_psuedo_depth > ystart)
12
            foreground = true;
13
        else
14
            foreground = false;
15
    }
16
    y = (ystart + (_psuedo_depth * 0.5)) - height;
17
    var _prog = 1 - (lifetime / start_lifetime);
18
    height = 100 - (200 * 
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); } }
(_prog, 3));
19
    fall_speed += 0.05;
20
    if (rising)
21
        y -= (
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); } }
(1 - ((lifetime - rise_start) / max_lifetime), 3) * 500);
22
    direction -= 10;
23
}
24
var _length = array_length(points);
25
with (obj_wind_trail_point)
26
{
27
    if (owner == other.id)
28
    {
29
        life -= (1 / other.child_lifetime);
30
        if (life < 0)
31
        {
32
            array_resize(other.points, _length - 1);
33
            instance_destroy();
34
        }
35
    }
36
}
37
if (lifetime > 0)
38
{
39
    if (!created)
40
    {
41
        xlast = x;
42
        ylast = y;
43
    }
44
    if (y > (owner.y + 20))
45
        y = owner.y + 20;
46
    timer++;
47
    var _point = instance_create(xlast, ylast, obj_wind_trail_point);
48
    _point.owner = id;
49
    _point.life = 1 - (1 / child_lifetime);
50
    _point.depth = depth;
51
    if (foreground_effect && foreground)
52
        _point.foreground = true;
53
    if (!created)
54
    {
55
        _point.direction = point_direction(xlast, ylast, x, y);
56
        created = true;
57
    }
58
    else
59
    {
60
        _point.direction = scr_angle_lerp(point_direction(_point.x, _point.y, x, y), point_direction(lastpoint.x, lastpoint.y, _point.x, _point.y), 0.5);
61
    }
62
    _point.sidex = lengthdir_x(1, _point.direction + 90);
63
    _point.sidey = lengthdir_y(1, _point.direction + 90);
64
    lastpoint = _point;
65
    array_insert(points, 0, _point);
66
}
67
lifetime--;
68
ylast = y;
69
xlast = x;
70
if (lifetime <= (0 - child_lifetime))
71
    instance_destroy();