/
showhighscore.lua
56 lines (40 loc) · 1.22 KB
/
showhighscore.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module (..., package.seeall)
local director = require ("director")
local ui = require("ui")
local highscore = require("highscore")
local globalLayer
local _W = display.contentWidth;
local _H = display.contentHeight;
function backToMenu()
director:changeScene("menu", "fade")
end
function new()
globalLayer = display.newGroup()
local back = display.newImage("highscoreBG.png")
back.x = _W/2
back.y = _H/2
back:scale(2.4, 2.4)
local highscoreButton = ui.newButton {
default = "highscore.png",
onPress = backToMenu
}
highscoreButton.x = 50
highscoreButton.y = _H - 115
-- highscore text
local score = highscore.getHighScore()
local scoreTextLabel = display.newText("YOUR HIGHSCORE", 0,0, "Komikoz", 38)
scoreTextLabel:setTextColor(0, 0, 0)
scoreTextLabel:setReferencePoint(display.TopLeftReferencePoint)
scoreTextLabel.x = _W/5
scoreTextLabel.y = _H/4
local scoreText = display.newText(score, 0,0, "Komikoz", 56)
scoreText:setTextColor(0, 0, 0)
scoreText:setReferencePoint(display.TopLeftReferencePoint)
scoreText.x = _W/3
scoreText.y = _H/2.5
globalLayer:insert(back)
globalLayer:insert(highscoreButton)
globalLayer:insert(scoreTextLabel)
globalLayer:insert(scoreText)
return globalLayer
end