Help me pls I want walking of my robot.
in
Programming Questions
•
9 months ago
- void setup(){
- size(500,500,OPENGL);
- }
- void draw(){
- background(127);
- drawhuman();
- }
- void drawhuman()
- {
- pushMatrix();
- translate(width/2, (height/2)-100);
- box(40);
- translate(0,80);
- scale(0.8,1);
- box(80);
- translate(70,0);
- scale(1,2);
- box(30);
- translate(-140,0);
- box(30);
- translate(50,40);
- scale(1,1.5);
- box(20,15,30);
- translate(0,18);
- box(20,15,30);
- translate(40,-18);
- scale(1,1.5);
- box(20,10,30);
- translate(0,12);
- box(20,10,30);
- popMatrix();
- }
- void keyPressed() {
- if (key == CODED) {
- switch (keyCode) {
- case DOWN:
- ; break;
- case UP:
- ; break;
- case LEFT:
- ; break;
- case RIGHT:
- translate(width/2,height/2);
- rotateY(radians(90));
- translate(0,0);
- drawhuman();
- ; break;
- }
- }
- }
body will start walking to the right, and vice versa. When the key is released, the body
will stop walking and stay straight.Help me pls.Thankss
1