Well, you make a segment in the sprite editor, pointing from left to right, and then you put its origin at Left Middle.
You make an object, give it the sprite, and then make a second object to control it.
In the second object, you do something like this:
Code:
/// Create Event
tentacle_length = 8;
segment_size = sprite_get_width(spr_segment);
var tx = x;
var ty = y;
var segment_direction = direction;
for (var segment = 0; segment < tentacle_length; segment += 1;)
{
tentacle[segment] = instance_create_layer(tx, ty, layer, obj_segment);
tentacle[segment].image_angle = segment_direction;
tentacle[segment].direction = segment_direction;
tx += lengthdir_x(segment_size, segment_direction);
ty += lengthdir_y(segment_size, segment_direction);
segment_direction += irandom_range(-20, 20);
}
This will generate the tentacle, and then you have a
pair of
for loops in the step event, one to handle controlling its behavior by rotation and a second to conversely update the position of each segment.