Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_ch5_LW20_zorgon_Step_0

(view raw script w/o annotations or w/e)
1
if (_parent == -4)
2
    exit;
3
if (!_input_enabled)
4
    exit;
5
update_facing();
6
collision_check();
7
x += px;
8
y += py;
9
if (x != nowx || y != nowy)
10
{
11
    wspeed = 
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); } }
(wspeed, 4, 0.02);
12
    if (!fullspeed)
13
    {
14
        if (wspeed >= 3.5)
15
        {
16
            fullspeed = true;
17
            with (_parent)
18
                trigger_event("zorgon_fullspeed");
19
        }
20
    }
21
}
22
walk = 0;
23
if (x != nowx && nopress == 0)
24
    walk = 1;
25
if (y != nowy && nopress == 0)
26
    walk = 1;
27
if (walk == 1)
28
    walkbuffer = 6;
29
update_walk();
30
scr_depth
scr_depth

function
scr_depth(arg0 = id, arg1 = 0)
{ with (arg0) depth = 100000 - ((y * 10) + (sprite_height * 10) + (arg1 * 10)); }
();
31
obj_mainchara.x = x;
32
obj_mainchara.y = y;