Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_followinglight_shrinking_Step_0

(view raw script w/o annotations or w/e)
1
if (light_con == 0)
2
{
3
    if (obj_mainchara.y >= 550)
4
        light_con = 1;
5
}
6
if (light_con == 1)
7
{
8
    radius = 
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); } }
(radius, 200, 2);
9
    edge_right = 21;
10
    edge_left = 54;
11
    with (obj_caterpillarchara)
12
    {
13
        if (name == "susie")
14
            target = 11;
15
        else if (name == "ralsei")
16
            target = 22;
17
    }
18
    if (obj_mainchara.y >= 1150)
19
        light_con = 2;
20
}
21
if (light_con == 2)
22
{
23
    radius = 
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); } }
(radius, 180, 2);
24
    edge_right = 20;
25
    edge_left = 55;
26
    with (obj_caterpillarchara)
27
    {
28
        if (name == "susie")
29
            target = 10;
30
        else if (name == "ralsei")
31
            target = 20;
32
    }
33
    if (obj_mainchara.y >= 1580)
34
        light_con = 3;
35
}
36
if (light_con == 3)
37
    radius = 
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); } }
(radius, 160, 2);
38
if (light_con == 4)
39
    radius = 
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); } }
(radius, 200, 2);
40
siner++;
41
smallerLight = (sin(siner / 30) * 10) + radius;
42
biggerLight = (sin((siner - 10) / 30) * 10) + radius + 40;