circle (float xpos, float ypos,float xspeed,float yspeed,float radi) {
x=xpos;
y=ypos;
xs=xspeed;
ys=yspeed;
r=radi;
}
void mover() {if(key == 'a'){
x+=xs;
if(x == 325)
{xs=0; ys=5; y+=ys;}
if(y == 325)
{ys=0; xs=-5;}
if(x == 100)
{xs = 0; ys = -5; y+=ys;}
if(y == 75)
{ys=0; xs=5;}}}
void display(){
fill(250,0,205);
ellipse(x,y,r,r);
}
}
Here is my code and there is a circle moving around a rectangle. I want to initiate it with using 'a' key and stop it with using 'b' key.I can start it with pressing 'a'. However if I press any other keys(like 'd' or 'i') circle stops moving around the rectangle. I just want to stop my circle with using 'b' key. Can someone help me? Thanks.