I am working on a simple game and trying to get it to restart by either clicking a button (or the mouse). I've looked at many different topics in the forum and tried to get the code to work, but it won't restart. Everything I read previously about making a restart point in setup() makes sense, I just can't get it to work. Here is my code (I have it working without LOSER being displayed, but I'm not sure why it is permanently there now...) Any help would be appreciated!
color bg = color(220,220,220);
float ballsize=40.0;
float speed = 1;
float yball = random(ballsize,(height-ballsize));
float xball = random(ballsize,(width-ballsize));
float ball_xdirection=1;
float ball_ydirection=1;
float textspeed = 0.01;
boolean lost = false;
int points = 0;
int opacity = 250;
PFont font1;
PFont font2;
PFont font3;
PFont font4;
void setup(){
size(300,300);
font1 = loadFont("BradleyHandITCTT-Bold-48.vlw");
font2 = loadFont("Garamond-14.vlw");
font3 = loadFont("Stencil-14.vlw");
font4 = loadFont("StarJedi-14.vlw");
reset();
}
void draw(){
smooth();
fill(214,22,44);
background(bg);
strokeWeight(1);
ellipse(xball,yball,ballsize,ballsize);
xball=xball+((.5*speed)*ball_xdirection);
yball=yball+(speed*ball_ydirection);
textFont(font3);
textAlign(CENTER);
textLeading(30);
fill(0,opacity);
String s = " BOUNCING BALLS! Use your mouse to keep the ball from touching the bottom. You get a point each time you save the ball, but be careful it gets faster!";