Created
September 24, 2020 03:54
-
-
Save OutlawGameTools/aa4667190e5d028f7655ad4e96e9e8eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Project: What the Shell?! | |
-- Description: | |
-- | |
-- Version: 1.0 | |
-- | |
-- Copyright 2016 Three Ring Ranch. All Rights Reserved. | |
-- | |
-- most commonly used screen coordinates | |
local centerX = display.contentCenterX | |
local centerY = display.contentCenterY | |
local countdown = {} | |
function countdown.nextNumber() | |
--print("Inside countdown.nextNumber") | |
countdown.number = countdown.number - 1 | |
if countdown.number > 0 then | |
countdown.text.text = countdown.number | |
countdown.text:scale ( 15, 15 ) | |
countdown.trans = transition.to ( countdown.text, {time=1000, xScale=0.1, yScale=0.1, onComplete=countdown.nextNumber }) | |
else | |
display.remove( countdown.text ) | |
countdown.runAfter() | |
end | |
end | |
function countdown.init(grp, numSeconds, runAfter, delay) | |
if countdown.number ~= nil and countdown.number > 0 then return end | |
local numSecs = numSeconds or 3 | |
local delay = delay or 0 | |
countdown.number = numSecs | |
countdown.runAfter = runAfter | |
countdown.text = display.newEmbossedText(grp, tostring(countdown.number), centerX, centerY, mainFont, 148 ) | |
countdown.text.alpha = 0 | |
timer.performWithDelay ( delay*1000, function() countdown.text.alpha=1; end ) | |
countdown.trans = transition.to ( countdown.text, {delay=delay*1000, time=1000, xScale=0.1, yScale=0.1, onComplete=countdown.nextNumber }) | |
--print("delay=" .. delay*1000) | |
--print("countdown.trans", countdown.trans) | |
--print("countdown.number", countdown.number) | |
end | |
return countdown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment