error with unexpected token void
in
Programming Questions
•
1 year ago
i am creating an alien as part of my uni coursework. it is to move etc. i have finished the latest step and for some reason it will not work it is supposed to move and bounce off the screen.
the problem lies at : void draweyebrow() {
here is my code:
int bodyXLoc = 200;
int bodyYLoc = 200;
int bodyWidth = 250;
int bodyHeight = 250;
int eyeWidth;
int eyeHeight;
int eyeXLoc;
int eyeYLoc;
int eyeballWidth;
int eyeballHeight;
int eyeballXloc;
int eyeballYloc;
int earleftWidth;
int earleftHeight;
int earleftXloc;
int earleftYloc;
int earrightWidth;
int earrightHeight;
int earrightXloc;
int earrightYloc;
int mouthXloc;
int mouthYloc;
int mouthHeight;
int mouthWidth;
int noseXloc;
int noseYloc;
int noseHeight;
int noseWidth;
int eyebrowXloc;
int eyebrowYloc;
int eyebrowHeight;
int eyebrowWidth;
int speed = 1;
void setup(){
size(700,700);
}
void draw(){
background(75);
stroke(0);
drawleftear();
drawrightear();
drawbody();
draweye();
draweyebrow();
draweyeball();
drawmouth();
drawnose();
move();
checkForBounce();
}
void drawleftear() {
fill(116,250,8);
earleftXloc = bodyXLoc - 50;
earleftYloc = bodyYLoc - 50;
earleftWidth = bodyWidth / 5;
earleftHeight = bodyHeight - 50;
ellipse(earleftXloc,earleftYloc,earleftWidth,earleftHeight);
}
void drawrightear() {
earrightWidth = bodyWidth / 4;
earrightHeight = bodyHeight - 50;
earrightXloc = bodyXLoc + 50;
earrightYloc = bodyYLoc - 50;
ellipse(earrightXloc,earrightYloc,earrightWidth,earrightHeight);
}
void drawbody() {
fill(255);
ellipse(bodyXLoc,bodyYLoc,bodyWidth,bodyHeight);
}
void draweye() {
int offSet = bodyWidth / 10;
eyeXLoc = bodyXLoc - offSet;
eyeYLoc = bodyYLoc - (bodyHeight / 4);
eyeWidth = bodyHeight / 5;
eyeHeight = bodyWidth / 5;
ellipse(eyeXLoc,eyeYLoc,eyeWidth,eyeHeight);
{
void draweyebrow() {
fill(0);
eyebrowXloc = bodyXLoc - 70;
eyebrowYloc = bodyYLoc - 85;
eyebrowWidth = bodyWidth - 150;
eyebrowHeight = bodyHeight / 25;
rect(eyebrowXloc,eyebrowYloc,eyebrowWidth,eyebrowHeight);
}
void draweyeball() {
fill(0);
int eyeballoffset = bodyWidth / 10;
eyeballXloc = bodyXLoc - eyeballoffset;
eyeballXloc = bodyXLoc - 25;
eyeballYloc = bodyYLoc - 50;
eyeballWidth = bodyHeight / 10;
eyeballHeight = bodyWidth / 10;
ellipse(eyeballXloc,eyeballYloc,eyeballWidth,eyeballHeight);
}
void drawmouth() {
fill(0);
mouthXloc = bodyXLoc;
mouthYloc = bodyYLoc + 75;
mouthWidth = bodyWidth - 100;
mouthHeight = bodyHeight - 150;
ellipse(mouthXloc,mouthYloc,mouthWidth,mouthHeight);7
}
void drawnose() {
fill(255,3,3);
noseXloc = bodyXLoc - 50;
noseYloc = bodyYLoc + 50;
noseWidth = bodyWidth - 100;
noseHeight = bodyHeight - 100;
ellipse(noseXloc,noseYloc,noseWidth,noseHeight);
}
void move() {
bodyXLoc = bodyXLoc + speed;
//bodyYLoc = bodyYLoc + 1;
}
void checkForBounce() {
if(bodyXLoc > width - (bodyWidth / 2 )) {
speed = speed * -1;
}
if(bodyXLoc < 0 + (bodyWidth / 2 )) {
speed = speed * -1;
}
}
1