I have the code to keep a current score while playing a game, but how do you draw a simple box, perhaps with or without a texture, like a board, with the “score: x” (“x” being your current score, don’t worry about all that.)
Here’s the code for the scoring…
fill(255,255,255,255)
textMode(CENTER)
textAlign(CENTER)
fontSize(20)
font("Zapfino")
text("Score: "..score,WIDTH/1.30,HEIGHT-20)
end
I would like the box to be centralized around the “score” text, and where it is positioned.
And I’m sorry for coming off like I don’t have a clue, but I’m still warming up to the draw functions…
Sorry
You can use w, h = textSize("Sample Text") to get the size of text (make sure to call it AFTER all the font()s and fontSize()s). Then you could try use textMode(CORNER), and have the X and Y be WIDTH - w, HEIGHT - h (w, h being text size)
Edit: here you go:
fill(255,255,255,255)
textMode(CORNER)
textAlign(RIGHT)
fontSize(20)
font("Zapfino")
local w, h = textSize("Score: "..score)
text("Score: "..score,WIDTH-w,HEIGHT-h)
end