1 |
event_inherited() |
2 |
bounce = 0 |
3 |
p_gravity = 0.2 |
4 |
p_friction = 0.99999 |
5 |
precision = 3 |
6 |
rope_sprite = 3461 |
7 |
base_x = x |
8 |
base_y = y |
9 |
r_length = irandom_range(150, 250) |
10 |
r_segments = 7 |
11 |
draw_colour = make_color_rgb(46, 35, 85) |
12 |
points = [] |
13 |
array_push(points, [base_x, base_y, base_x, base_y, true, rope_sprite, 0]) |
14 |
for (var i = 0; i < (r_segments - 1); i++) |
15 |
array_push(points, [base_x, (points[i][1] + r_length / r_segments), base_x, (points[i][1] + r_length / r_segments), false, rope_sprite, irandom_range(0, 5)]) |
16 |
sticks = [] |
17 |
for (i = 0; i < (r_segments - 2); i++) |
18 |
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)]), choose(-1, 1), false]) |
19 |
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)]), choose(-1, 1), false]) |