1 |
if (i_ex(target)) |
2 |
{ |
3 |
if (moved == 0) |
4 |
{ |
5 |
x = target.x; |
6 |
y = target.y; |
7 |
dist = distance_to_point(movex, movey); |
8 |
dir = point_direction(x, y, movex, movey); |
9 |
amt = dist / movemax; |
10 |
xadd = lengthdir_x(amt, dir); |
11 |
yadd = lengthdir_y(amt, dir); |
12 |
moved = 1; |
13 |
} |
14 |
target.x += xadd; |
15 |
target.y += yadd; |
16 |
if (target.object_index == obj_actor) |
17 |
{ |
18 |
target.fake_speed = amt; |
19 |
target.fake_direction = dir; |
20 |
} |
21 |
movetimer += 1; |
22 |
target.x = lerp(x, movex, movetimer / movemax); |
23 |
target.y = lerp(y, movey, movetimer / movemax); |
24 |
if (movetimer >= movemax) |
25 |
{ |
26 |
if (target.object_index == obj_actor) |
27 |
target.fake_speed = 0; |
28 |
if (charmarker == 1) |
29 |
target.fun = 0; |
30 |
if (charmarker == 2) |
31 |
{ |
32 |
with (target) |
33 |
{ |
34 |
follow = 1; |
35 |
fun = 0; |
36 |
scr_caterpillar_interpolatescr_caterpillar_interpolatefunction scr_caterpillar_interpolate()
{
_newfacing = scr_facing_letter_to_number( scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x;
remy[0] = obj_mainchara.y;
facing[0] = _newfacing;
for (_iaia = target; _iaia > 0; _iaia -= 1)
{
remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target);
if (global.darkzone == 1)
remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target);
else
remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target);
facing[_iaia] = _newfacing;
}
} (); |
37 |
} |
38 |
} |
39 |
instance_destroy(); |
40 |
} |
41 |
if (target == obj_move_to_point) |
42 |
instance_destroy(); |
43 |
} |
44 |
else |
45 |
{ |
46 |
instance_destroy(); |
47 |
} |