Added scores and achievement to score page
This commit is contained in:
@@ -2,6 +2,7 @@ let buttonSelectScore = 0;
|
||||
let searchName = '';
|
||||
let scorescreenOn = false;
|
||||
let dataIsCalled = false;
|
||||
let clearDataOnce = false;
|
||||
function keyPressed() {
|
||||
// Check if the back button was selected and the Enter key was pressed
|
||||
if (keyCode == ENTER && buttonSelectScore == 0) {
|
||||
@@ -72,6 +73,11 @@ function scoremenu() {
|
||||
text(letters[currentIndex[0]], width / 2 - 30, height / 3);
|
||||
text(letters[currentIndex[1]], width / 2, height / 3);
|
||||
text(letters[currentIndex[2]], width / 2 + 30, height / 3);
|
||||
if (!clearDataOnce) {
|
||||
requesteddata = [];
|
||||
clearDataOnce = true;
|
||||
}
|
||||
|
||||
|
||||
if (scorescreenOn && keyReleasedFlag) {
|
||||
nameSubmit();
|
||||
@@ -93,16 +99,33 @@ function scoremenu() {
|
||||
nameDraw(3);
|
||||
}
|
||||
|
||||
push()
|
||||
fill(255, 255, 255)
|
||||
textSize(25)
|
||||
textAlign(CENTER, CENTER)
|
||||
//text for name, score, achievements
|
||||
for (let i = 0; i < requesteddata.length; i++) {
|
||||
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score, width / 5, height / 3 + (i * 30))
|
||||
text(i + 1 + ". " + requesteddata[i].Naam + ": " + requesteddata[i].Score + " " + requesteddata[i].Datum, width / 4, height / 3 + (i * 30))
|
||||
}
|
||||
pop()
|
||||
|
||||
push()
|
||||
fill(255, 255, 255)
|
||||
textSize(16)
|
||||
textAlign(CENTER, CENTER)
|
||||
for (let i = 0; i < requesteddata.length; i++) {
|
||||
text(i + 1 + ". " + requesteddata[i].Achievements, width / 4 * 3, height / 3 + (i * 30))
|
||||
}
|
||||
pop()
|
||||
|
||||
push()
|
||||
stroke(4, 217, 255)
|
||||
strokeWeight(5)
|
||||
fill(0, 255, 0, 0)
|
||||
rect(width / 4 * 3, height / 2, width / 4, height / 1.25)
|
||||
rect(width / 4, height / 2, width / 4, height / 1.25)
|
||||
//box left
|
||||
rect(width / 4 * 3, height / 2, width / 3, height / 1.25)
|
||||
//box right
|
||||
rect(width / 4, height / 2, width / 3, height / 1.25)
|
||||
pop()
|
||||
push()
|
||||
text("Your scores", width / 4, height / 6)
|
||||
|
Reference in New Issue
Block a user