1 |
if (wall_destroy == 1) |
2 |
{ |
3 |
if (x < (__view_get(e__VW.XView, 0) - 80)) |
4 |
instance_destroy(); |
5 |
if (x > (__view_get(e__VW.XView, 0) + 760)) |
6 |
instance_destroy(); |
7 |
if (y < (__view_get(e__VW.YView, 0) - 80)) |
8 |
instance_destroy(); |
9 |
if (y > (__view_get(e__VW.YView, 0) + 580)) |
10 |
instance_destroy(); |
11 |
} |
12 |
if (!init) |
13 |
{ |
14 |
var laneOffset = (x > obj_growtangle.x) ? 0 : (gt_maxx() - obj_growtangle.x); |
15 |
inst = collision_rectangle(obj_growtangle.x - laneOffset, gt_miny(), gt_maxx() - laneOffset, gt_maxy(), obj_omawaroid_policecar, false, true); |
16 |
if (inst != -4) |
17 |
{ |
18 |
var finishtime = (inst.y - (gt_miny() - 20)) / inst.speed; |
19 |
var catchuptime = 0; |
20 |
if (inst.speed < speed) |
21 |
{ |
22 |
catchuptime = (ystart - (inst.y + 40)) / (speed - inst.speed); |
23 |
if (catchuptime < finishtime) |
24 |
turnSignal = true; |
25 |
} |
26 |
} |
27 |
if (turnSignal) |
28 |
sprite_index = (x > obj_growtangle.x) ? leftTurnSprite : rightTurnSprite; |
29 |
init = true; |
30 |
} |
31 |
if (initialSpeed == 0) |
32 |
initialSpeed = speed; |
33 |
if (state == 2) |
34 |
{ |
35 |
speed -= 0.5; |
36 |
} |
37 |
else if (state == 1) |
38 |
{ |
39 |
laneTimer += 0.05; |
40 |
lanePosition = 0; |
41 |
if (laneTimer < 1) |
42 |
{ |
43 |
lanePosition = lerp(0, 1.25, scr_ease_inoutscr_ease_inoutfunction scr_ease_inout(arg0, arg1)
{
if (arg1 < -3 || arg1 > 7)
return arg0;
if (arg1 == -3)
return ease_inout_bounce(arg0, 0, 1, 1);
else if (arg1 == -2)
return ease_inout_elastic(arg0, 0, 1, 1);
else if (arg1 == -1)
return ease_inout_back(arg0, 0, 1, 1);
else if (arg1 == 1)
return -0.5 * cos((pi * arg0) - 1);
else if (arg1 == 0)
return arg0;
arg0 *= 2;
if (arg0 < 1)
{
return 0.5 * scr_ease_in(arg0, arg1);
}
else
{
arg0--;
return 0.5 * ( scr_ease_out(arg0, arg1) + 1);
}
} (laneTimer, 3)); |
44 |
} |
45 |
else if (laneTimer < 1.5) |
46 |
{ |
47 |
lanePosition = lerp(1.25, 0.9, scr_ease_inoutscr_ease_inoutfunction scr_ease_inout(arg0, arg1)
{
if (arg1 < -3 || arg1 > 7)
return arg0;
if (arg1 == -3)
return ease_inout_bounce(arg0, 0, 1, 1);
else if (arg1 == -2)
return ease_inout_elastic(arg0, 0, 1, 1);
else if (arg1 == -1)
return ease_inout_back(arg0, 0, 1, 1);
else if (arg1 == 1)
return -0.5 * cos((pi * arg0) - 1);
else if (arg1 == 0)
return arg0;
arg0 *= 2;
if (arg0 < 1)
{
return 0.5 * scr_ease_in(arg0, arg1);
}
else
{
arg0--;
return 0.5 * ( scr_ease_out(arg0, arg1) + 1);
}
} ((laneTimer - 1) * 2, 4)); |
48 |
} |
49 |
else if (laneTimer < 2) |
50 |
{ |
51 |
lanePosition = lerp(0.9, 1, scr_ease_inoutscr_ease_inoutfunction scr_ease_inout(arg0, arg1)
{
if (arg1 < -3 || arg1 > 7)
return arg0;
if (arg1 == -3)
return ease_inout_bounce(arg0, 0, 1, 1);
else if (arg1 == -2)
return ease_inout_elastic(arg0, 0, 1, 1);
else if (arg1 == -1)
return ease_inout_back(arg0, 0, 1, 1);
else if (arg1 == 1)
return -0.5 * cos((pi * arg0) - 1);
else if (arg1 == 0)
return arg0;
arg0 *= 2;
if (arg0 < 1)
{
return 0.5 * scr_ease_in(arg0, arg1);
}
else
{
arg0--;
return 0.5 * ( scr_ease_out(arg0, arg1) + 1);
}
} ((laneTimer - 1.5) * 2, 4)); |
52 |
} |
53 |
else |
54 |
{ |
55 |
state = 0; |
56 |
lanePosition = 1; |
57 |
x = lane; |
58 |
} |
59 |
if (turnSignal && laneTimer >= 1) |
60 |
{ |
61 |
turnSignal = false; |
62 |
sprite_index = forwardSprite; |
63 |
image_index %= 4; |
64 |
} |
65 |
speed = initialSpeed - (0.25 * (1 - abs(laneTimer - 1))); |
66 |
x = lerp(previousLane, lane, lanePosition); |
67 |
image_angle = lerp(0, point_direction(x, y, lane - (x - lane), y - 50) - 90, min(laneTimer * 2, 1)); |
68 |
} |
69 |
else if (turnSignal) |
70 |
{ |
71 |
bottomScan = y - 20; |
72 |
var laneCheck = sign(x - obj_growtangle.x); |
73 |
inst = collision_rectangle(obj_growtangle.x + (laneCheck * 3), y - 15 - (speed * 7), obj_growtangle.x + (laneCheck * 30), bottomScan, obj_omawaroid_policecar, false, true); |
74 |
if (inst != -4) |
75 |
{ |
76 |
previousLane = x; |
77 |
lane = obj_growtangle.x - (x - obj_growtangle.x); |
78 |
laneTimer = 0; |
79 |
state = 1; |
80 |
} |
81 |
} |
82 |
|
83 |
enum e__VW |
84 |
{ |
85 |
XView, |
86 |
YView, |
87 |
WView, |
88 |
HView, |
89 |
Angle, |
90 |
HBorder, |
91 |
VBorder, |
92 |
HSpeed, |
93 |
VSpeed, |
94 |
Object, |
95 |
Visible, |
96 |
XPort, |
97 |
YPort, |
98 |
WPort, |
99 |
HPort, |
100 |
Camera, |
101 |
SurfaceID |
102 |
} |