I want to make stickmans move

Hello, I’m currently learning how to use processing in the school for an upcoming big project- making an advertisement for sports day. For my advert, I want to make my stickman running by animating the stickmans, but I don’t know how to. Can someone please tell/help me how to animate stickmans to make them run?

1 Like

first you need to have someone or you draw the stickman then flip through the pictures

1 Like

That’s right.

It’s very hard to do programmatically, especially the coordination of the angles

see also Push matrix and trig functions help (robot BD-1)

example below with one leg

float x; 

float a=2.29;
float aAdd=.04; 

float b=0.3;
float bAdd=.04; 

void setup()
{
  // init
  size(1800, 600);
} // func 

void draw() 
{
  // runs on and on 
  background(0);

  stroke(255); 

  translate(width+x, height/2); 
  x--;
  ellipse(-6, -66, 22, 22); 
  line ( 0, -44, 
    0, 44);

  // upper thigh
  translate(0, 44);
  rotate(a);
  line(0, 0, 44, 0);

  // lower thigh
  translate(44, 0);
  rotate(b);
  line(0, 0, 44, 0);

  a+=aAdd;
  if (a>2.5)
    aAdd=-1*abs(aAdd);
  if (a<.6)
    aAdd=abs(aAdd);

  b+=bAdd;
  if (b>0.0)
    bAdd=-1*abs(bAdd);
  if (b<-1)
    bAdd*=-1;
} // func 

// --------------------------------------------------
1 Like