1 |
scr_depth(); |
2 |
targetx = (obj_mainchara.x + (obj_mainchara.sprite_width / 2)) - (sprite_width / 2); |
3 |
targety = (obj_mainchara.y + (obj_mainchara.sprite_height / 2)) - (sprite_height / 2); |
4 |
if (global.interact == 0) |
5 |
frozen = 0; |
6 |
if (scr_outside_camerascr_outside_camerafunction scr_outside_camera(arg0)
{
_offcamera = 0;
rightx = x + sprite_width;
leftx = x;
bottomy = y + sprite_height;
topy = y;
if (x > (__view_get(e__VW.XView, 0) + __view_get(e__VW.WView, 0) + arg0))
_offcamera = 1;
if (rightx < (__view_get(e__VW.XView, 0) - arg0))
_offcamera = 1;
if (y > (__view_get(e__VW.YView, 0) + __view_get(e__VW.HView, 0) + arg0))
_offcamera = 1;
if (bottomy < (__view_get(e__VW.YView, 0) - arg0))
_offcamera = 1;
return _offcamera;
}
enum e__VW
{
XView,
YView,
WView,
HView,
Angle,
HBorder,
VBorder,
HSpeed,
VSpeed,
Object,
Visible,
XPort,
YPort,
WPort,
HPort,
Camera,
SurfaceID
} (200) && offscreen_frozen == 1) |
7 |
frozen = 1; |
8 |
else |
9 |
frozen = 0; |
10 |
if (global.interact != 0) |
11 |
frozen = 1; |
12 |
if (frozen == 1) |
13 |
{ |
14 |
if (hadfrozen == 0) |
15 |
{ |
16 |
remspeed = speed; |
17 |
speed = 0; |
18 |
hadfrozen = 1; |
19 |
} |
20 |
} |
21 |
if (frozen == 0) |
22 |
{ |
23 |
if (hadfrozen == 1) |
24 |
{ |
25 |
if (speed == 0) |
26 |
speed = remspeed; |
27 |
hadfrozen = 0; |
28 |
} |
29 |
if (pacecon == 0) |
30 |
{ |
31 |
pacetimer += 1; |
32 |
if (pacetype == 0) |
33 |
{ |
34 |
} |
35 |
if (pacetype == 1) |
36 |
{ |
37 |
if (pacetimer == 10) |
38 |
hspeed = 2; |
39 |
if (pacetimer == 34) |
40 |
hspeed = 0; |
41 |
if (pacetimer == 50) |
42 |
hspeed = -2; |
43 |
if (pacetimer == 74) |
44 |
hspeed = 0; |
45 |
if (pacetimer == 80) |
46 |
pacetimer = 0; |
47 |
} |
48 |
if (pacetype == 2) |
49 |
{ |
50 |
hspeed = sin(pacetimer / 24) * 4; |
51 |
vspeed = cos(pacetimer / 24) * 4; |
52 |
} |
53 |
if (pacetype == 5) |
54 |
{ |
55 |
if (pacetimer == 1) |
56 |
vspeed = 6; |
57 |
if (pacetimer == 25) |
58 |
vspeed = -6; |
59 |
if (y < ystart) |
60 |
pacetimer = 0; |
61 |
} |
62 |
if (pacetype == 6) |
63 |
{ |
64 |
cancelwalk = 1; |
65 |
walk_index += 0.25; |
66 |
} |
67 |
if (pacetype == 7) |
68 |
hspeed = -sin(pacetimer / 30) * 10; |
69 |
if (pacetype == 7.5) |
70 |
hspeed = sin(pacetimer / 30) * 10; |
71 |
if (pacetype == 8) |
72 |
vspeed = -sin(pacetimer / 25) * 12.5; |
73 |
if (pacetype == 9) |
74 |
{ |
75 |
hspeed = sin(pacetimer / (pacespeed * 30)) * (moveradius / 20); |
76 |
pacespeed = 0.8; |
77 |
} |
78 |
if (pacetype == 10) |
79 |
{ |
80 |
if (pacecon2 == 0) |
81 |
{ |
82 |
if (vspeed > 0) |
83 |
vspeed *= 0.9; |
84 |
if (vspeed <= 0.5 && pacecon2 == 0) |
85 |
pacecon2 = 1; |
86 |
} |
87 |
if (pacecon2 == 1) |
88 |
move_towards_point(obj_mainchara.x, obj_mainchara.y, 4); |
89 |
} |
90 |
} |
91 |
if (alertcon == 0) |
92 |
{ |
93 |
alerttimer += 1; |
94 |
if (alerttimer >= 6) |
95 |
{ |
96 |
alerttimer -= 6; |
97 |
if (distance_to_point(targetx + (sprite_width / 2), targety + (sprite_height / 2)) <= radius) |
98 |
{ |
99 |
speed = 0; |
100 |
pacecon = 1; |
101 |
alerttimer = 0; |
102 |
alertcon = 1; |
103 |
snd_play(snd_b); |
104 |
instance_create(x + (sprite_width / 2), y - 20, obj_excblcon); |
105 |
alarm[4] = 20; |
106 |
} |
107 |
} |
108 |
} |
109 |
if (alertcon == 2) |
110 |
{ |
111 |
if (chasetype == 0) |
112 |
{ |
113 |
if (speed < 4) |
114 |
speed = 4; |
115 |
if (speed < 7) |
116 |
speed += 0.5; |
117 |
move_towards_point(targetx, targety, speed); |
118 |
} |
119 |
if (chasetype == 1) |
120 |
{ |
121 |
if (alerttimer == 0) |
122 |
move_towards_point(targetx, targety, 10); |
123 |
alerttimer += 1; |
124 |
if (alerttimer >= 20) |
125 |
speed *= 0.75; |
126 |
if (alerttimer >= 25) |
127 |
speed = 0; |
128 |
if (alerttimer >= 27) |
129 |
alerttimer = 0; |
130 |
} |
131 |
if (chasetype == 2) |
132 |
{ |
133 |
if (alerttimer == 0) |
134 |
{ |
135 |
xnext = 0; |
136 |
ynext = 0; |
137 |
if (right_h()) |
138 |
xnext = 132; |
139 |
if (left_h()) |
140 |
xnext = -132; |
141 |
if (down_h()) |
142 |
ynext = 132; |
143 |
if (up_h()) |
144 |
ynext = -132; |
145 |
move_towards_point(targetx + xnext, targety + ynext, 10); |
146 |
} |
147 |
alerttimer += 1; |
148 |
if (alerttimer >= 20) |
149 |
speed *= 0.75; |
150 |
if (alerttimer >= 25) |
151 |
speed = 0; |
152 |
if (alerttimer >= 27) |
153 |
alerttimer = 0; |
154 |
} |
155 |
if (chasetype == 3) |
156 |
{ |
157 |
if (speed < 2) |
158 |
speed = 2; |
159 |
if (speed < 4) |
160 |
speed += 0.5; |
161 |
move_towards_point(targetx, targety, speed); |
162 |
} |
163 |
if (chasetype == 4) |
164 |
{ |
165 |
if (speed < 6) |
166 |
speed = 6; |
167 |
if (speed < 14) |
168 |
speed += 0.5; |
169 |
move_towards_point(targetx, targety, speed); |
170 |
} |
171 |
} |
172 |
facetimer += 1; |
173 |
if (facetimer >= 10) |
174 |
{ |
175 |
if (hspeed <= -0.2 && facing == 1) |
176 |
{ |
177 |
facing = 0; |
178 |
facetimer = 0; |
179 |
} |
180 |
if (hspeed >= 0.2 && facing == 0) |
181 |
{ |
182 |
facing = 1; |
183 |
facetimer = 0; |
184 |
} |
185 |
} |
186 |
if (cancelwalk == 0) |
187 |
{ |
188 |
walk_index += (speed / 20); |
189 |
if (speed == 0) |
190 |
walk_index = 0; |
191 |
} |
192 |
} |