Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_pl_follow_Step_0

(view raw script w/o annotations or w/e)
1
if (obj_pl.player_mode == "DalvExit")
2
{
3
    scr_walk_ai
scr_walk_ai

function scr_walk_ai(argument0, argument1, argument2, argument3, argument4) //gml_Script_scr_walk_ai { dalv_walk_speed = argument3 condition_1 = false if (no_loop_destination_dalv == false) { var destination_x = abs(x - argument0) var destination_y = abs(y - argument1) var axis_override = argument4 if (axis_override == "x" || axis_override == "y") dalv_walk_axis = axis_override else { var result = sign(destination_x - destination_y) switch result { case 1: dalv_walk_axis = "x" break case -1: dalv_walk_axis = "y" break default: dalv_walk_axis = "y" } } dalv_walk_speed_x = (sign(argument0 - x)) * dalv_walk_speed dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed no_loop_destination_dalv = true } if (x == argument0 && y == argument1) { npc_walking = false path_speed = 0 image_speed = 0 image_index = 0 return; } switch dalv_walk_axis { case "x": x_previous = x x += dalv_walk_speed_x if (abs(argument0 - x) < dalv_walk_speed && place_free(argument0, y) && (!(place_meeting(argument0, y, argument2)))) x = argument0 if (place_free(x, y) && (!(place_meeting(x, y, argument2))) && x_previous != argument0) { npc_walking = true image_speed = 0.2 if (dalv_walk_speed_x == (-dalv_walk_speed)) direction = 180 else if (dalv_walk_speed_x == dalv_walk_speed) direction = 0 } if ((!(place_free(x, y))) || place_meeting(x, y, argument2) || x_previous == argument0) { x = x_previous dalv_walk_axis = "y" return; } dalv_walk_speed_y = (sign(argument1 - y)) * dalv_walk_speed i = x + dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) { condition_1 = true break } else continue } if (condition_1 == true) { while (i != argument0) { i += dalv_walk_speed_x j = y if (abs(argument0 - i) < dalv_walk_speed) i = argument0 while (j != argument1) { j += dalv_walk_speed_y if (abs(argument1 - j) < dalv_walk_speed) j = argument1 if (i == argument0 && j == argument1) return; else if ((!(place_free(i, j))) || place_meeting(i, j, argument2)) break else { if (j == argument1) return; continue ...
(obj_dalv2.destination_x_dalv, obj_dalv2.destination_y_dalv, obj_wall, 3, "x")
4
    obj_pl.x = x
5
    obj_pl.y = y
6
    obj_dalv2.solid = false
7
}
8
if (obj_pl.player_mode == "Normal")
9
    instance_destroy()
10
if (x != xprevious || y != yprevious)
11
    image_speed = 0.2
12
else
13
{
14
    image_speed = 0
15
    image_index = 0
16
}
17
if (direction == 0)
18
    sprite_index = rsprite
19
if (direction == 90)
20
    sprite_index = usprite
21
if (direction == 180)
22
    sprite_index = lsprite
23
if (direction == 270)
24
    sprite_index = dsprite