Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_incense_cloud_manager_Step_0

(view raw script w/o annotations or w/e)
1
if (global.turntimer < 1)
2
    instance_destroy();
3
timer++;
4
cloud_approach = 
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; }
(cloud_approach, 0.25, 0.0025);
5
sin_power = 1 + (sin(timer * 0.05) * power_val);
6
cos_power = 1 - (sin(timer * 0.05) * power_val);
7
contraction = 1 + (sin(timer * 0.06) * 0.2);
8
with (obj_incense_cloud)
9
    image_alpha = 
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; }
(image_alpha, 1, 0.05);
10
x = obj_growtangle.x + (sin(timer * 0.03) * 36 * movedir_1);
11
y = obj_growtangle.y + (sin(timer * 0.06) * 28 * movedir_2);
12
with (obj_incense_cloud)
13
{
14
    var ultimate_goal = (distance_goal * other.contraction) + (sin((other.timer * 0.1) + individual_value) * 4);
15
    distance = 
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; }
(distance, ultimate_goal, abs(distance - ultimate_goal) * other.cloud_approach);
16
    current_angle += (ratio * other.turn_direction);
17
    image_angle = current_angle - 90;
18
    x = other.x + lengthdir_x(distance * other.sin_power, current_angle);
19
    y = other.y + lengthdir_y(distance * other.cos_power, current_angle);
20
    if (instance_number(obj_incense_cloud) < 3)
21
    {
22
        if (!irandom(127))
23
        {
24
            with (instance_create(x + irandom_range(-32, 32), y + irandom_range(-32, 32), obj_incense_sparkle))
25
            {
26
                direction = random(360);
27
                speed = 0.5 + random(1.5);
28
            }
29
        }
30
    }
31
}