hi,
i don’t see my error…i would have a progress bar depending of the the countTap but it’s seems that my “progressBar” don’t want to reduce. the process removeProgressBar() don’t work…why ?
thanks for your help.
--LEVEL-------------------------------------------------------------------------------------------------- local countTap = 0 local numberMaxProgressBar = 50 local progressBarLength = 10 --BACKGROUND BACK------------------------------------------------------------------------------------------- local BackgroundBack = display.newImageRect( myGroupBackgroundBack, "background.png", 240, 240) BackgroundBack.x = 240 BackgroundBack.y = 160 BackgroundBack.xScale = 10 BackgroundBack.yScale = 10 local flagButtonTouch =true local oRemove = display.remove local function calculateprogressbarlength() progressBarLength = countTap \* 5 print("progressBarLength", progressBarLength) return progressBarLength end local function mathcountTap() if progressBarLength \<= numberMaxProgressBar then countTap = countTap + 1 print ("countTap",countTap, "progressBarLength", progressBarLength ) end if progressBarLength \> numberMaxProgressBar then countTap = 0 end return countTap end local function createprogressbar() print("create") local progressBar = display.newImageRect( myGroupCharacter, "progress.png", progressBarLength, 16 ) progressBar.x, progressBar.y = display.contentWidth \* 0.5, display.contentHeight \* 0 return progressBar end local function removeProgressBar() oRemove(progressBar) progressBar = nil print("remove") end function BackgroundBack:touch( event ) mathcountTap() calculateprogressbarlength() createprogressbar() removeProgressBar() end BackgroundBack:addEventListener( "touch", BackgroundBack )
