|
1
|
if (_bullet_marker == -4)
|
|
2
|
exit;
|
|
3
|
if (!_bullet_active)
|
|
4
|
exit;
|
|
5
|
if (_fade_out)
|
|
6
|
{
|
|
7
|
var is_complete = false;
|
|
8
|
var target_x = _target_pos.x;
|
|
9
|
var target_y = _target_pos.y;
|
|
10
|
with (_bullet_marker)
|
|
11
|
{
|
|
12
|
image_alpha = scr_movetowardsscr_movetowards
function scr_movetowards(arg0, arg1, arg2)
{
if (arg0 == arg1)
return arg0;
else if (arg0 > arg1)
return max(arg0 - arg2, arg1);
else
return min(arg0 + arg2, arg1);
}
function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0)
{
scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1);
}
function scr_obj_movetowards_point(arg0, arg1, arg2)
{
var _distance = point_distance(x, y, arg0, arg1);
if (arg2 >= _distance)
{
x = arg0;
y = arg1;
}
else
{
var _direction = point_direction(x, y, arg0, arg1);
x += lengthdir_x(arg2, _direction);
y += lengthdir_y(arg2, _direction);
}
} (image_alpha, 0, 0.1);
|
|
13
|
scr_obj_movetowards_point(target_x, target_y, 8);
|
|
14
|
if (image_alpha <= 0)
|
|
15
|
is_complete = true;
|
|
16
|
}
|
|
17
|
if (is_complete)
|
|
18
|
stop();
|
|
19
|
}
|
|
20
|
else
|
|
21
|
{
|
|
22
|
var bullet_distance = point_distance(_bullet_marker.x, _bullet_marker.y, _target_pos.x, _target_pos.y);
|
|
23
|
var target_x = _target_pos.x;
|
|
24
|
var target_y = _target_pos.y;
|
|
25
|
if (bullet_distance <= 20)
|
|
26
|
{
|
|
27
|
with (_bullet_marker)
|
|
28
|
{
|
|
29
|
image_alpha = scr_movetowardsscr_movetowards
function scr_movetowards(arg0, arg1, arg2)
{
if (arg0 == arg1)
return arg0;
else if (arg0 > arg1)
return max(arg0 - arg2, arg1);
else
return min(arg0 + arg2, arg1);
}
function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0)
{
scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1);
}
function scr_obj_movetowards_point(arg0, arg1, arg2)
{
var _distance = point_distance(x, y, arg0, arg1);
if (arg2 >= _distance)
{
x = arg0;
y = arg1;
}
else
{
var _direction = point_direction(x, y, arg0, arg1);
x += lengthdir_x(arg2, _direction);
y += lengthdir_y(arg2, _direction);
}
} (image_alpha, 0, 0.4);
|
|
30
|
scr_obj_movetowards_point(target_x, target_y, 8);
|
|
31
|
}
|
|
32
|
if (_bullet_marker.image_alpha <= 0)
|
|
33
|
_bullet_active = false;
|
|
34
|
}
|
|
35
|
else
|
|
36
|
{
|
|
37
|
with (_bullet_marker)
|
|
38
|
{
|
|
39
|
image_alpha = scr_movetowardsscr_movetowards
function scr_movetowards(arg0, arg1, arg2)
{
if (arg0 == arg1)
return arg0;
else if (arg0 > arg1)
return max(arg0 - arg2, arg1);
else
return min(arg0 + arg2, arg1);
}
function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0)
{
scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1);
}
function scr_obj_movetowards_point(arg0, arg1, arg2)
{
var _distance = point_distance(x, y, arg0, arg1);
if (arg2 >= _distance)
{
x = arg0;
y = arg1;
}
else
{
var _direction = point_direction(x, y, arg0, arg1);
x += lengthdir_x(arg2, _direction);
y += lengthdir_y(arg2, _direction);
}
} (image_alpha, 1, 0.2);
|
|
40
|
scr_obj_movetowards_point(target_x, target_y, 8);
|
|
41
|
}
|
|
42
|
}
|
|
43
|
}
|