Question with void key pressed
in
Programming Questions
•
1 month ago
I created a "zoog" for my class and I now have to make it move in relation with the arrow keys.
Please Help?
float eyeR;
float eyeG;
float eyeB;
float X= random(30,190);
float Y= random(30,100);
void setup(){
size(200,200);
frameRate(5);
X= X;
Y= Y;
}
void draw(){
background(0);//Draw a black background
float X= random(30,170);
float Y= random(30,100);
//Set ellipses and triangles to CENTER
ellipseMode(CENTER);
rectMode(CENTER);
//Zoog's body
stroke(39,242,29);
fill(255);
triangle(X,Y,X+30,Y+80,X-30,Y+80);
//Zoog's head
fill(39,242,29);
ellipse(X+0,Y+5,60,60);
stroke(127);
line(X+10,Y+20,X-10,Y+20);
//Zoog's eyes
eyeR=random(255);
eyeG=random(255);
eyeB=random(255);
fill(eyeR,eyeG,eyeB);
ellipse(X-19,Y+0,16,25);
ellipse(X+19,Y+0,16,25);
//Zoog's Legs
stroke(255);
line(X-10,Y+80,X-20,Y+100);
line(X-20,Y+100,X-10,Y+60);
line(X+10,Y+80,X+20,Y+100);
line(X+20,Y+100,X+10,Y+50);
}
1