Pac Man Blinky code
in
Programming Questions
•
2 years ago
Can someone post the code to make Blinky look left and right by clicking the mouse? Here's what I have so far.
int look = 2;
void setup(){
size(200,200);
noStroke();
}
void draw(){
fill(255,0,0);
rect(50,70,10,90); // from left, bar 1
rect(60,40,10,130); // from left, bar 2
rect(70,30,10,140); // from left, bar 3
rect(80,20,10,140); // from left, bar 4
rect(90,20,10,130); // from left, bar 5
rect(100,10,10,150); // from left, bar 6
rect(110,10,10,160); // from left, bar 7
rect(120,10,10,160); // from left, bar 8
rect(130,10,10,150); // from left, bar 9
rect(140,20,10,130); // from left, bar 10
rect(150,20,10,140); // from left, bar 11
rect(160,30,10,140); // from left, bar 12
rect(170,40,10,130); // from left, bar 13
rect(180,70,10,90); // from left, bar 14
// eyes
fill(255,255,255);
rect(60+look*10,50,10,30);
rect(70+look*10,40,10,50);
rect(80+look*10,40,10,50);
rect(90+look*10,50,10,30);
rect(120+look*10,50,10,30);
rect(130+look*10,40,10,50);
rect(140+look*10,40,10,50);
rect(150+look*10,50,10,30);
fill(0,0,255);
rect(60+look*20,60,20,20); // left pupil
rect(120+look*20,60,20,20); // right pupil
}
1