1 |
if live_call() |
2 |
return global.live_result; |
3 |
event_inherited() |
4 |
if instance_exists(obj_verlet_rope_generator) |
5 |
image_alpha = obj_verlet_rope_generator.image_alpha |
6 |
bounce = 0.9 |
7 |
p_gravity = 0.8 |
8 |
p_friction = 0.9 |
9 |
precision = 3 |
10 |
rope_sprite = 3581 |
11 |
base_x = x |
12 |
base_y = y |
13 |
r_length = 130 |
14 |
r_segments = 13 |
15 |
r_width = 1.5 |
16 |
can_move = false |
17 |
wind_power = 0.04 |
18 |
wind_power_max = 0.05 |
19 |
wind_direction = 1 |
20 |
wind_direction_change_countdown = 80 |
21 |
wind_direction_change_countdown_max = 80 |
22 |
sway = 0 |
23 |
alarm[0] = 10alarm[0]if live_call()
return global.live_result;
if (sway == 0)
sway = sign(wind_power) * 0.03
else
sway = 0
alarm[0] = 15 |
24 |
alarm[1] = 30alarm[1]if live_call()
return global.live_result;
can_move = true |
25 |
points = [] |
26 |
array_push(points, [base_x, base_y, base_x, base_y, true, rope_sprite]) |
27 |
for (var i = 0; i < (r_segments - 1); i++) |
28 |
array_push(points, [base_x, (points[i][1] + r_length / r_segments), base_x, (points[i][1] + r_length / r_segments), false, rope_sprite]) |
29 |
sticks = [] |
30 |
for (i = 0; i < (r_segments - 1); i++) |
31 |
array_push(sticks, [points[i], points[(i + 1)], scr_distancescr_distancefunction scr_distance(argument0, argument1) //gml_Script_scr_distance
{
var dx = argument1[0] - argument0[0]
var dy = argument1[1] - argument0[1]
return sqrt(dx * dx + dy * dy);
} (points[i], points[(i + 1)]), r_width, 255, 255, false]) |