Gizmo199
Member
THE IDEA
I am trying to create a system that lets me create animations using the sequencer from a side perspective and then adjust the coordinates from the sequencer instances to rotate properly around in a faux-3d space. Here are some gifs of the idea:as you can see in the Second gif it works like a charm if I am just drawing lines to x/y coordinates.
Create
Step
Draw
GML:
// UAR = Upper arm right | LAR = Lower arm right | HAR = Hand arm right
connect_array = [bone_UAR, bone_LAR, bone_HAR];
for ( var i=0; i<array_length(connect_array); i++ ){
dx[i] = x;
dy[i] = y;
}
GML:
direction = point_direction(x, y, mouse_x, mouse_y);
for ( var i=0; i<array_length(connect_array); i++ ){
var _ins = connect_array[i];
dx[i] = _ins.x * dcos(direction);
dy[i] = _ins.y;
}
GML:
for ( var i=0; i<array_length(connect_array)-1; i++ ){
draw_line_width(x + dx[i], y + dy[i], x + dx[i+1], y + dy[i+1], connect_array[i].thickness);
}
THE PROBLEM
So I am having a hard time figuring out how to draw a sprite as a line. By that, I mean drawing a sprite to stretch to a certain coordinate. If I alter the code in the draw event to:Draw
GML:
for ( var i=0; i<array_length(connect_array)-1; i++ ){
var _pdir = point_direction(x + dx[i], y + dy[i], x + dx[i+1], y + dy[i+1]);
draw_sprite_ext(connect_array[i].sprite_index, connect_array[i].image_index, x+dx[i], y+dy[i],
connect_array[i].image_xscale, connect_array[i].image_yscale, _pdir,
connect_array[i].image_blend, connect_array[i].image_alpha);
}
So what I am asking is what is the best way to make it so that the sprites will stretch accordingly depending on the rotation. I have tried altering image_xscale values along the directional sine (dsin) of the angle but it just makes all of the individual bone/limbs shrink to nothing. Any help would be amazing! Thanks in advance!
EDIT: The Reason I need it to stretch it is because once the y position of the connect-ED bone is above the y position of the connect-ING you get that weird jittery 'point_direction' issue when the points are too close together.