We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I need to make this ellipse respond to my arrow keys and eat small orbs(pac man points) This is what ive done so far
float ang = 0;
float speed = 10;
int posx = 50;
int posy = 300;
int i = 1;
void setup(){
background (128);
size(800, 600);
frameRate(20);
ellipseMode(RADIUS);
fill(#FAF312);
noStroke();
}
void draw() {
background (128);
ang = atan2(mouseY - posy, mouseX - posx);
posx += speed * cos(ang);
posy += speed * sin(ang);
translate(posx, posy);
rotate(ang);
//arc(50,50,75,75,.51,5.02);
if (i == 1){
arc(50, 50, 50, 50, .51, 5.9);
i = -i;
} else {
ellipse(50, 50, 50, 50);
i = -i;
}
}
Answers
you need to add direction and direction2 to
posx
andposy
(no ang / cos etc. !!!)then use this function:
It keeps telling me unexpected token for posx Can you like the complete code you used to make it work?
No. I am not at home
You need to declare everything and debug it
Also click on the tag #pacman below your first post