1 |
if (global.player_sprites == "dunescave") |
2 |
{ |
3 |
palette_index = 4 |
4 |
shader_on = true |
5 |
} |
6 |
else if (global.player_sprites == "normal") |
7 |
shader_on = false |
8 |
if (obj_pl.yprevious != obj_pl.y || obj_pl.xprevious != obj_pl.x) |
9 |
{ |
10 |
npc_move_current = clamp((npc_move_current + 1), 0, npc_move_delay_max) |
11 |
x_new[npc_move_current] = obj_pl.x |
12 |
y_new[npc_move_current] = obj_pl.y |
13 |
dir_new[npc_move_current] = obj_pl.direction |
14 |
if (abs(obj_pl.yprevious - obj_pl.y) >= 5 || abs(obj_pl.xprevious - obj_pl.x) >= 5) |
15 |
sprinting_new[npc_move_current] = true |
16 |
else |
17 |
sprinting_new[npc_move_current] = false |
18 |
} |
19 |
if (npc_move_current >= npc_move_delay_max) |
20 |
{ |
21 |
npc_move_current = clamp((npc_move_current - 1), 0, npc_move_delay_max) |
22 |
x = x_new[1] |
23 |
y = y_new[1] |
24 |
follower_idle = false |
25 |
switch dir_new[1] |
26 |
{ |
27 |
case 0: |
28 |
if (sprinting_new[1] == true) |
29 |
sprite_index = right_sprite_run |
30 |
else |
31 |
sprite_index = right_sprite |
32 |
break |
33 |
case 90: |
34 |
if (sprinting_new[1] == true) |
35 |
sprite_index = up_sprite_run |
36 |
else |
37 |
sprite_index = up_sprite |
38 |
break |
39 |
case 180: |
40 |
if (sprinting_new[1] == true) |
41 |
sprite_index = left_sprite_run |
42 |
else |
43 |
sprite_index = left_sprite |
44 |
break |
45 |
case 270: |
46 |
if (sprinting_new[1] == true) |
47 |
sprite_index = down_sprite_run |
48 |
else |
49 |
sprite_index = down_sprite |
50 |
break |
51 |
} |
52 |
|
53 |
image_speed = 0.2 |
54 |
if (sprinting_new[1] == true) |
55 |
image_speed = 0.3 |
56 |
for (var i = 0; i < npc_move_delay_max; i++) |
57 |
{ |
58 |
x_new[i] = x_new[(i + 1)] |
59 |
y_new[i] = y_new[(i + 1)] |
60 |
dir_new[i] = dir_new[(i + 1)] |
61 |
sprinting_new[i] = sprinting_new[(i + 1)] |
62 |
} |
63 |
} |
64 |
else |
65 |
{ |
66 |
follower_idle = true |
67 |
switch dir_new[1] |
68 |
{ |
69 |
case 0: |
70 |
sprite_index = right_sprite_idle |
71 |
break |
72 |
case 90: |
73 |
sprite_index = up_sprite_idle |
74 |
break |
75 |
case 180: |
76 |
sprite_index = left_sprite_idle |
77 |
break |
78 |
case 270: |
79 |
sprite_index = down_sprite_idle |
80 |
break |
81 |
} |
82 |
|
83 |
} |
84 |
if (npc_reset == true) |
85 |
{ |
86 |
event_perform(ev_create, 0) |
87 |
var player_distance = (point_distance(x, y, obj_pl.x, obj_pl.y)) / 10 |
88 |
player_distance = clamp(player_distance, 1, 999) |
89 |
for (i = npc_move_delay_max; i > 0; i--) |
90 |
{ |
91 |
x_new[i] = x + (sign(obj_pl.x - x)) * (i * player_distance) |
92 |
y_new[i] = y + (sign(obj_pl.y - y)) * (i * player_distance) |
93 |
if (point_distance(x, y, x_new[npc_move_delay_max], y) > point_distance(x, y, x, y_new[npc_move_delay_max])) |
94 |
{ |
95 |
if (x_new[npc_move_delay_max] > x) |
96 |
dir_new[i] = 0 |
97 |
else |
98 |
dir_new[i] = 180 |
99 |
} |
100 |
else if (y_new[npc_move_delay_max] > y) |
101 |
dir_new[i] = 270 |
102 |
else |
103 |
dir_new[i] = 90 |
104 |
npc_move_current += 1 |
105 |
} |
106 |
npc_reset = false |
107 |
} |
108 |
if (follower_idle == true) |
109 |
{ |
110 |
if (instance_exists(obj_dialogue) && is_talking == true) |
111 |
{ |
112 |
if (obj_dialogue.cutoff == string_length(obj_dialogue.message[obj_dialogue.message_current])) |
113 |
{ |
114 |
image_speed = 0 |
115 |
image_index = 0 |
116 |
} |
117 |
else |
118 |
image_speed = 0.2 |
119 |
} |
120 |
else |
121 |
{ |
122 |
image_speed = 0 |
123 |
image_index = 0 |
124 |
is_talking = false |
125 |
} |
126 |
} |
127 |
if (sprites_water_override == true) |
128 |
{ |
129 |
up_sprite = 2012 |
130 |
right_sprite = 1048 |
131 |
down_sprite = 3578 |
132 |
left_sprite = 3373 |
133 |
up_sprite_idle = 543 |
134 |
right_sprite_idle = 2036 |
135 |
down_sprite_idle = 3610 |
136 |
left_sprite_idle = 3453 |
137 |
up_sprite_run = 2676 |
138 |
right_sprite_run = 2292 |
139 |
down_sprite_run = 2840 |
140 |
left_sprite_run = 2797 |
141 |
} |
142 |
else if (sprites_water_override == 2) |
143 |
{ |
144 |
sprites_water_override = 0 |
145 |
up_sprite = 273 |
146 |
right_sprite = 270 |
147 |
down_sprite = 274 |
148 |
left_sprite = 272 |
149 |
up_sprite_idle = 262 |
150 |
right_sprite_idle = 263 |
151 |
down_sprite_idle = 265 |
152 |
left_sprite_idle = 268 |
153 |
up_sprite_run = 277 |
154 |
right_sprite_run = 278 |
155 |
down_sprite_run = 280 |
156 |
left_sprite_run = 279 |
157 |
} |