prister
YaBB Newbies
Offline
Posts: 10
Re: Helped with mouseMoved please!
Reply #6 - Nov 13th , 2009, 11:05am
Okay I think i might know why the monster doesnt show up and I also want to know the reason for this coding... in order to get the eye to work (as in scoota's post) under void draw it needs to be like this void draw() { background(225, 225, 225);//This makes the background white// monster();//This sets up the coding for what is considered the monster mouth();//This sets up the coding for when the mouth needs to be mouse reactive eye(width/2, height/2); } When I try to make eye like the monster and mouth with nothing within the parenthesis it does not work and when I don't put any number after the / the eye is completely off center and does not show the monster body... what is the reason for putting (width/2, height/2) and how do i fix it so my monster shows....this is my current coding with the eye following the mouse but does not show the monster for some reason void setup() { size(600, 600);//This is the size of the box holding the monster smooth(); } void draw() { background(225, 225, 225);//This makes the background white// monster();//This sets up the coding for what is considered the monster mouth();//This sets up the coding for when the mouth needs to be mouse reactive eye(width/2, height/2); } void monster (){ fill(0); stroke(0); ellipse(300, 300, 300, 300);//This is the black circle body of the monster// fill(0); stroke(0); triangle(190, 200, 250, 200, 220, 90);//Monster ear left// fill(0); stroke(0); triangle(350, 200, 410, 200, 380, 90);//Monster ear right// fill(225); stroke(225); ellipse(300, 250, 50, 75);//This is the sclera of the monster eye// fill(0); stroke(0); ellipse(300, 275, 20, 20);//This is the pupil of the monster eye// fill(225); stroke(225); triangle(280, 300, 320, 300, 300, 320);//This is the nose of the monster// fill(225); stroke(225); line(310, 310, 350, 310);//Right Whisker pointing straight// fill(225); stroke(225); line(310, 310, 340, 340);//Right Whisker pointing down// fill(225); stroke(225); line(310, 310, 360, 330);//Right Whisker in-between// fill(225); stroke(225); line(290, 310, 250, 310);//Left Whisker pointing straight// fill(225); stroke(225); line(290, 310, 260, 340);//Left Whisker pointing down// fill(225); stroke(225); line(290, 310, 240, 330);//Left Whisker in-between// fill(0); stroke(0); ellipse(300, 500, 100, 150);//Monster body// fill(225); stroke(225); ellipse(330, 475, 20, 20);//Monster paw right// fill(225); stroke(225); ellipse(270, 475, 20, 20);//Monster paw left// fill(0); stroke(0); rect(330, 550, 60, 10);//Monster tail// fill(0); stroke(0); ellipse(390, 550, 30, 30);//Monster tail end// } void mouth(){ if(mousePressed == true && dist(300, 375, mouseX, mouseY)<30){//When the mouse is pressed the monster mouth will close and "eat the mouse"// fill(225); stroke(225); noCursor(); ellipse(300, 375, 70, 1);//Mouth closed// } else{//When the mouse is released the monster mouth opens again for more food// cursor(ARROW); fill(225); stroke(225); ellipse(300, 375, 70, 70);//Mouth opened// } } void eye(int x, int y) { background(225); fill(225); stroke(225); ellipse(300, 250, 50, 75);//This is the sclera of the monster eye// int pX = (int) map(mouseX, 0, width, -10, 10); //allows the pupil to follow the mouse int pY = (int) map(mouseY, 0, height, -60, -25); //allows the pupil to follow the mouse fill(0); ellipse(x + pX, y + pY, 20, 20); //this is the pupil }