This is something that I really want to do but I have absolutely no idea where to start!
At the end of each cycle in the game, the user's score is displayed. I would like the sketch to remember the 5 lowest scores (the aim is to achieve the lowest score possible) and display them on a leaderboard.
I would like to be able to have three initials next to the top 5 highest scores.
for example the scoreboard would look like this
AMP - 343
LVW - 356
MPG - 359
MPG - 406
SJW - 410
Then if the next player scored 360, the game would prompt them to enter three initials, eg- AHM
the scoreboard would update to
AMP - 343
LVW - 356
MPG - 359
AHM - 360
MPG - 406
but if a player scored 500, it would not prompt for an initial and the scoreboard would remain as is.
furthermore, any way to write the results to a save file which would recall the data when the sketch was closed and reopened.
Any suggestions of where to even start would be greatly welcome! Thanks in advance!!
I've managed to configure my program to respond to keyPressed and mousePressed with the result to change the mode.
I'm now trying to get a timer to start counting down at mode==2 and when the timer finishes {mode=3}. I know that this part works
class DownTimer {
//***local variables
int startTime;
float countDown;
// ***constructor
DownTimer(){
countDown=4000;
}
//***functions
void start(){
startTime=millis();
}
boolean timeEnd() {
int timeGone=millis()- startTime;
if (timeGone>countDown) {return true;}
else {return false;}
}
}
but implementing it into the sketch is not working for me: I'm not receiving any errors, the program just isn't changing from "mode==2" to "mode==3". I'm currently using this code:
text("Test your reation skills and be the best on the laederboard.", width/2, height-12-height/8);
text("--PRESS ANY KEY TO CONTINUE--", width/2, height+12-height/8);
}
void titleText() {
fill(255, 157, 0);
textFont(title_font, 42);
text("VELOCE-REACTOR", width/2, height/6);
}
}
B_ReadyScreen
class ReadyScreen {
//***local variables
PFont main_font;
// ***constructor
ReadyScreen(){
smooth();
background(0);
main_font=loadFont("v_font.vlw");
textAlign(CENTER);
rectMode(CENTER);
}
//***functions
void run(){
indicate();
indicateText();
instructText();
}
void indicate(){
fill(255,0,0);
rect(width/2,height/2, width-width/8,height/4);
}
void indicateText(){
fill(255);
textFont(main_font, 32);
text("READY?", width/2, height/6);
}
void instructText(){
fill(255);
textFont(main_font, 20);
text("Feeling alert? Click anywhere to Start!", width/2, height-12-height/8);
}
}
C_SteadyScreen
class SteadyScreen {
//***local variables
PFont main_font;
// ***constructor
SteadyScreen(){
background(0);
smooth();
main_font=loadFont("v_font.vlw");
textAlign(CENTER);
rectMode(CENTER);
}
//***functions
void run(){
indicate();
indicateText();
instructText();
}
void indicate(){
fill(240,132,0);
rect(width/2,height/2, width-width/8,height/4);
}
void indicateText(){
fill(255);
textFont(main_font, 32);
text("STEADY!!", width/2, height/6);
}
void instructText(){
fill(255);
textFont(main_font, 20);
text("When the light goes green, click fast!", width/2, height-12-height/8);
}
}
D_GoScreen
class GoScreen {
//***local variables
PFont main_font;
// ***constructor
GoScreen(){
background(0);
smooth();
main_font=loadFont("v_font.vlw");
textAlign(CENTER);
rectMode(CENTER);
}
//***functions
void run(){
indicate();
indicateText();
instructText();
}
void indicate(){
fill(11,240,0);
rect(width/2,height/2, width-width/8,height/4);
}
void indicateText(){
fill(255);
textFont(main_font, 32);
text("GO! GO! GO!", width/2, height/6);
}
void instructText(){
fill(255);
textFont(main_font, 20);
text("CLICK NOW!", width/2, height-12-height/8);
}
}
I would HUGELY appreciate any help at all with this as I've got into a bit of a rabbit hole and keep trying the same things that just don't work. Sorry if it's something really obvious and I've missed something wildly obvious that's been mentioned on another thread.