textAlign(center) added

This commit is contained in:
Mees Roelofsz
2023-12-13 15:31:06 +01:00
parent 2019e194b4
commit 26cadcf1aa

View File

@@ -91,10 +91,10 @@ function gameOver() {
push(); push();
fill(255, 255, 255) fill(255, 255, 255)
textSize(32); textSize(32);
textAlign(CENTER);
text(letters[currentIndex[0]], width / 2 - 25, height / 2); text(letters[currentIndex[0]], width / 2 - 25, height / 2);
text(letters[currentIndex[1]], width / 2, height / 2); text(letters[currentIndex[1]], width / 2, height / 2);
text(letters[currentIndex[2]], width / 2 + 25, height / 2); text(letters[currentIndex[2]], width / 2 + 25, height / 2);
text(iIndex, width / 2 + 50, height / 2);
pop(); pop();
if (key == ' ') { if (key == ' ') {
@@ -418,24 +418,7 @@ function spawnRandomBullet() {
function homescreen() { function homescreen() {
// push() textAlign(CENTER);
// fill(0, 0, 0, 200)
// square(0, 0, 1600)
// pop()
// push()
// fill(255, 0, 0)
// let buttonHeight = height/2
// rect(width/2-90, buttonHeight, 200, 40 , 20, 20, 20, 20)
// textSize(25)
// fill(0,0,0)
// text("Start Game", width/2+10, buttonHeight+30)
// if (mouseX > width/2-90 && mouseX < width/2+110 && mouseY > height/2 && mouseY < buttonHeight+40) {
// if (mouseIsPressed) {
// homescreenOn = false;
// }
// }
// pop()
button(0, 0, 0, width / 2 - 90, height / 2, 200, 40, "Start Game") button(0, 0, 0, width / 2 - 90, height / 2, 200, 40, "Start Game")
button(0, 0, 0, width / 2 - 90, height / 2 + 50, 200, 40, "Scores") button(0, 0, 0, width / 2 - 90, height / 2 + 50, 200, 40, "Scores")