-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.lua
32 lines (27 loc) · 959 Bytes
/
player.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
local Player = {score = 0, xPos = 0, yPos = 0, tries = 0}
local highScore = require("highscore")
local myHighScore = highScore:new()
function Player:new( o )
o = o or {}
setmetatable( o, self )
self.__index = self
self.scoreText=display.newEmbossedText( "Score: 0", 200, 50,native.systemFont, 30 );
self.scoreText:setFillColor( 0,0.5,0 );
self.scoreText:setEmbossColor( color );
self.scoreText.anchorX = 0
self.scoreText.anchorY = 0
self.heighSCore=display.newEmbossedText( "High: "..myHighScore:getHigScore(), 210, 0,native.systemFont, 30 );
self.heighSCore:setFillColor( 1,0,0 );
self.heighSCore:setEmbossColor( color );
self.myHighScore = myHighScore
self.heighSCore.anchorX = 0
self.heighSCore.anchorY = 0
return o
end
function Player:displayScore( score )
self.score = self.score + score
self.scoreText.x = self.xPos
self.scoreText.y = self.yPos
self.scoreText.text = "Score: "..self.score
end
return Player