yes I have figured it out .Moreover the promlem lies with one of my file(scor.lua)
Could you help me telling how to use that score.lua with director class
[lua]module(…, package.seeall)
local numbers = {
[string.byte("-")] = “-.png”,
[string.byte(“0”)] = “0.png”,
[string.byte(“1”)] = “1.png”,
[string.byte(“2”)] = “2.png”,
[string.byte(“3”)] = “3.png”,
[string.byte(“4”)] = “4.png”,
[string.byte(“5”)] = “5.png”,
[string.byte(“6”)] = “6.png”,
[string.byte(“7”)] = “7.png”,
[string.byte(“8”)] = “8.png”,
[string.byte(“9”)] = “9.png”,
[string.byte(" ")] = “space.png”,
}
local scoreGroup = display.newGroup()
local scorebgimg = display.newImage( “scorebg.png” )
scoreGroup:insert( scorebgimg )
local backgroundBorder = 10
scoreGroup:insert( scorebgimg )
local numberGroup = display.newGroup()
scoreGroup:insert( numberGroup )
local theScore = 0
function init( params )
scoreGroup.x = params.x
scoreGroup.y = params.y
setScore( 0 )
end
function getInfo()
return {
x = scoreGroup.x,
y = scoreGroup.y,
xmax = scoreGroup.x + scoreGroup.contentWidth,
ymax = scoreGroup.y + scoreGroup.contentHeight,
contentWidth = scoreGroup.contentWidth,
contentHeight = scoreGroup.contentHeight,
score = theScore
}
end
function update()
scoreGroup:remove(2)
local numberGroup = display.newGroup()
scoreGroup:insert( numberGroup )
local scoreStr = tostring( theScore )
local scoreLen = string.len( scoreStr )
local i = scoreLen
local x = scoreGroup.contentWidth - backgroundBorder
local y = scoreGroup.contentHeight / 2
while i > 0 do
local c = string.byte( scoreStr, i )
local digitPath = numbers[c]
local characterImage = display.newImage( digitPath )
numberGroup:insert( characterImage )
characterImage.x = x - characterImage.width / 2
characterImage.y = y
x = x - characterImage.width
i = i - 1
end
end
function getScore()
return theScore
end
function setScore( score )
theScore = score
update()
end[/lua] [import]uid: 82446 topic_id: 17804 reply_id: 68109[/import]