Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_cliff_crater_whirlwind_Step_0

(view raw script w/o annotations or w/e)
1
if (!active)
2
    exit;
3
if (!
scr_onscreen_tolerance
scr_onscreen_tolerance

function
scr_onscreen_tolerance(arg0, arg1)
{ obj = arg0; spacer = arg1; var __cx = camera_get_view_x(view_camera[0]); var __cy = camera_get_view_y(view_camera[0]); if ((obj.x + obj.sprite_width + spacer) < __cx || (obj.x - spacer) > (__cx + 640) || (obj.y + obj.sprite_height + spacer) < __cy || (obj.y - spacer) > (__cy + 480)) return false; else return true; }
(id, 100))
4
    exit;
5
timer++;
6
if (strength > 1)
7
    strength = 
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); } }
(strength, 3, 0.2);
8
ys = 
scr_platswap_yscale
scr_platswap_yscale

function
scr_platswap_yscale()
{ with (obj_platswap) return __transition_yscale; return [0, 1]; }
();
9
if (timer >= rate)
10
{
11
    var _leaf = ((count % 2) == 0) ? instance_create(x, y + 40, obj_whirlwind_particle) : instance_create(x, y + 40, obj_cliff_crater_leaf);
12
    _leaf.siner = random(62.83185307179586);
13
    _leaf.lifetime = lifetime;
14
    _leaf.style = style;
15
    _leaf.owner = id;
16
    _leaf.downward = true;
17
    _leaf.depth = depth;
18
    timer = 0;
19
    if (count >= next_trail)
20
    {
21
        var _windtrail = instance_create(x, y, obj_cliff_crater_windtrail);
22
        wind_direction += (180 + irandom_range(-30, 30));
23
        _windtrail.direction = wind_direction;
24
        _windtrail.owner = id;
25
        _windtrail.depth = depth;
26
        _windtrail.downward = true;
27
        if ((count % 2) == 0)
28
            count = -1;
29
        next_trail = count + 1 + irandom_range(10, 16);
30
    }
31
    count++;
32
}