1 |
if (move_x != 0) |
2 |
last_move_x = move_x |
3 |
if (move_y != 0) |
4 |
last_move_y = move_y |
5 |
if (move_x == 0) |
6 |
{ |
7 |
move_x_count = 0 |
8 |
if (idle_x_count < max_move_counter) |
9 |
idle_x_count += 1 |
10 |
} |
11 |
else |
12 |
{ |
13 |
idle_x_count = 0 |
14 |
if (move_x < 0) |
15 |
{ |
16 |
if (move_x_count > 0) |
17 |
move_x_count = 0 |
18 |
if (move_x_count > (-max_move_counter)) |
19 |
move_x_count -= 1 |
20 |
} |
21 |
else if (move_x > 0) |
22 |
{ |
23 |
if (move_x_count < 0) |
24 |
move_x_count = 0 |
25 |
if (move_x_count < max_move_counter) |
26 |
move_x_count += 1 |
27 |
} |
28 |
} |
29 |
if (move_y == 0) |
30 |
{ |
31 |
move_y_count = 0 |
32 |
if (idle_y_count < max_move_counter) |
33 |
idle_y_count += 1 |
34 |
} |
35 |
else |
36 |
{ |
37 |
idle_y_count = 0 |
38 |
if (move_y < 0) |
39 |
{ |
40 |
if (move_y_count > 0) |
41 |
move_y_count = 0 |
42 |
if (move_y_count > (-max_move_counter)) |
43 |
move_y_count -= 1 |
44 |
} |
45 |
else if (move_y > 0) |
46 |
{ |
47 |
if (move_y_count < 0) |
48 |
move_y_count = 0 |
49 |
if (move_y_count < max_move_counter) |
50 |
move_y_count += 1 |
51 |
} |
52 |
} |
53 |
if (x != x_previous) |
54 |
last_hsp = move_x |
55 |
if (y != y_previous) |
56 |
last_vsp = move_y |
57 |
if (x == x_previous) |
58 |
{ |
59 |
move_hsp_count = 0 |
60 |
if (idle_hsp_count < max_speed_counter) |
61 |
idle_hsp_count += 1 |
62 |
} |
63 |
else |
64 |
{ |
65 |
idle_hsp_count = 0 |
66 |
if (x < x_previous) |
67 |
{ |
68 |
if (move_hsp_count > 0) |
69 |
move_hsp_count = 0 |
70 |
if (move_hsp_count > (-max_speed_counter)) |
71 |
move_hsp_count -= 1 |
72 |
} |
73 |
else if (x > x_previous) |
74 |
{ |
75 |
if (move_hsp_count < 0) |
76 |
move_hsp_count = 0 |
77 |
if (move_hsp_count < max_speed_counter) |
78 |
move_hsp_count += 1 |
79 |
} |
80 |
} |
81 |
if (y == y_previous) |
82 |
{ |
83 |
move_vsp_count = 0 |
84 |
if (idle_vsp_count < max_speed_counter) |
85 |
idle_vsp_count += 1 |
86 |
} |
87 |
else |
88 |
{ |
89 |
idle_vsp_count = 0 |
90 |
if (y < y_previous) |
91 |
{ |
92 |
if (move_vsp_count > 0) |
93 |
move_vsp_count = 0 |
94 |
if (move_vsp_count > (-max_speed_counter)) |
95 |
move_vsp_count -= 1 |
96 |
} |
97 |
else if (y > y_previous) |
98 |
{ |
99 |
if (move_vsp_count < 0) |
100 |
move_vsp_count = 0 |
101 |
if (move_vsp_count < max_speed_counter) |
102 |
move_vsp_count += 1 |
103 |
} |
104 |
} |