1 |
if (!init) |
2 |
{ |
3 |
init = true; |
4 |
path_set_kind(mypath, 1); |
5 |
path_set_precision(mypath, 4); |
6 |
path_set_closed(mypath, 0); |
7 |
var relativeY = 0; |
8 |
path_add_point(mypath, x, y, 100); |
9 |
path_add_point(mypath, x - 30, y, 100); |
10 |
var boxy = obj_growtangle.y; |
11 |
for (i = 1; i < 5; i++) |
12 |
{ |
13 |
var xpoint = (-150 * i) + x; |
14 |
if (aim_at_player && scr_monsterpop() == 1 && relativeY == 0 && (xpoint - (obj_heart.x + 10)) <= 150) |
15 |
{ |
16 |
relativeY = random_range(-80 * i, 80 * i) + boxy; |
17 |
path_add_point(mypath, xpoint, relativeY, 100); |
18 |
relativeY = ((obj_heart.y + 10) - relativeY) / abs((obj_heart.x + 10) - xpoint); |
19 |
} |
20 |
else if (aim_at_player && scr_monsterpop() == 1 && relativeY != 0) |
21 |
{ |
22 |
relativeY = obj_heart.y + 10 + (relativeY * abs((obj_heart.x + 10) - xpoint)); |
23 |
path_add_point(mypath, xpoint, clamp(relativeY, (-80 * i) + boxy, (80 * i) + boxy), 100); |
24 |
relativeY = 0; |
25 |
} |
26 |
else |
27 |
{ |
28 |
path_add_point(mypath, xpoint, random_range(-80 * i, 80 * i) + boxy, 100); |
29 |
} |
30 |
} |
31 |
} |