public void setPlayerHighScore(String s)
{Label scoreBoardMsg = new Label("Your Score:" + s,35);
Label highScoreMsg = new Label("Your Best:" + recordAndReturnHighScore(s),35);
addObject(scoreBoardMsg,getWidth()/2,getHeight()*1/2);
addObject(highScoreMsg,getWidth()/2,(getHeight()*1/2)+45);}
private String recordAndReturnHighScore( String s)
{String hs= null;
try { Path scoreFile = Paths.get("./scoreFile.txt");
if(Files.exists(scoreFile))
{ byte[] bytes = Files.readAllBytes(scoreFile);
hs = new String(bytes);
if(Integer.parseInt(s) > Integer.parseInt(hs)) {
Files.write(scoreFile,s.getBytes());
hs = s;
}} else{Files.write(scoreFile,s.getBytes()); hs=s; }
} catch(IOException e){ System.out.println("IOException");}
return hs;
}

