1 |
if (obj_pl.yprevious != obj_pl.y || obj_pl.xprevious != obj_pl.x) |
2 |
{ |
3 |
npc_move_current += 1 |
4 |
x_new[npc_move_current] = obj_pl.x |
5 |
y_new[npc_move_current] = obj_pl.y |
6 |
dir_new[npc_move_current] = obj_pl.direction |
7 |
} |
8 |
if (npc_move_current >= npc_move_delay_max) |
9 |
{ |
10 |
npc_move_current -= 1 |
11 |
x = x_new[1] |
12 |
y = y_new[1] |
13 |
switch dir_new[1] |
14 |
{ |
15 |
case 0: |
16 |
sprite_index = right_sprite |
17 |
break |
18 |
case 90: |
19 |
sprite_index = up_sprite |
20 |
break |
21 |
case 180: |
22 |
sprite_index = left_sprite |
23 |
break |
24 |
case 270: |
25 |
sprite_index = down_sprite |
26 |
break |
27 |
} |
28 |
|
29 |
can_animate = true |
30 |
image_speed = 0.2 |
31 |
for (var i = 0; i < npc_move_delay_max; i++) |
32 |
{ |
33 |
x_new[i] = x_new[(i + 1)] |
34 |
y_new[i] = y_new[(i + 1)] |
35 |
dir_new[i] = dir_new[(i + 1)] |
36 |
} |
37 |
} |
38 |
if (can_animate == true && npc_move_current < npc_move_delay_max) |
39 |
{ |
40 |
if on_animation_end() |
41 |
{ |
42 |
image_index = 0 |
43 |
image_speed = 0 |
44 |
can_animate = false |
45 |
} |
46 |
} |