I was inpired by Excalibur333's platform example to try to animate a running cycle using GML.
I first used Excalibur333's code as a base for the person's upper leg animation://Right upper leg angle[0] = 270 + (50*(sin(incr[0])))incr[0]+=0.2end_x[0] = x + lengthdir_x(50, angle[0] )end_y[0] = y + lengthdir_y(50, angle[0] )//Left upper leg angle[2] = 270 + (50*(sin(incr[2])))incr[2] -=0.2end_x[2] = x + lengthdir_x(50, angle[2] )end_y[2] = y + lengthdir_y(50, angle[2] )After studying how a human runs and many hours of trial and error, I came up with the lower leg's animation://Right lower leg angle[1] = 310 + (50*(sin(incr[1])))incr[1]+=(50*(sin(incr[0])))/1000end_x[1] = end_x[0] + lengthdir_x(50, angle[1] )end_y[1] = end_y[0] + lengthdir_y(50, angle[1] )//Left lower leg angle[3] = 336 + (50*(sin(incr[3])))incr[3] += (50*(sin(incr[0]*-1))))/1000end_x[3] = end_x[2] + lengthdir_x(50, angle[3] )end_y[3] = end_y[2] + lengthdir_y(50, angle[3] )Feet://Rightfoot_x[0] = end_x[1] + lengthdir_x(20, angle[1]-130 )foot_y[0] = end_y[1] + lengthdir_y(20, angle[1]-130 )//Leftfoot_x[1] = end_x[3] + lengthdir_x(20, angle[3]-130 )foot_y[1] = end_y[3] + lengthdir_y(20, angle[3]-130 )Draw://Rightdraw_line_width(x,y,end_x[0],end_y[0],5)draw_line_width(end_x[0],end_y[0],end_x[1],end_y[1],5)//Leftdraw_line_width(x,y,end_x[2],end_y[2],5)draw_line_width(end_x[2],end_y[2],end_x[3],end_y[3],5)/Body Placeholderdraw_line_width(x,y,x-5,y-70,5)//Feetdraw_line_width(end_x[1],end_y[1],foot_x[0],foot_y[0],10)draw_line_width(end_x[3],end_y[3],foot_x[1],foot_y[1],10)_______________________________I still have to do the arms, body head, etc. I may also try to do a walking animation as well.Example
Very nice. The front leg could do with going slightly more vertical though.
That is pretty cool - looking forward to the entire animation!
With some slight modifications it can even be used for 3d models with multiple parts. I'd check it out but I boycott gm 7 for its immobility.
Sweet. I thought about doing lower legs to but the game I am working on is a simpler style and so I just decided to stick with what I had. Great job. I can't wait to see it finished.
You do realize that the body goes up and down while walking, right?