1 Reply Latest reply on Apr 3, 2012 1:16 PM by Mister MUX

    Lingo Question


      Hello again,

                       Basicall i'm creating a game and i want a countdown (like 5, 4, 3, 2 ,1, GO) before each level. How would i go about scripting this? I want 1 second in between each part ie. 5 ( wait a second), 4 (wait a second) etc. I have no idea how to make the 1 second pause between members switching. Any help is appreciated, thanks.

        • 1. Re: Lingo Question
          Mister MUX Level 2

          Well there a at least a couple of ways to do this. One is to use a timeout object. There has been recent posts about this so a search should provide more info.


          Alternatively you could do something like this. It may need so tweaking depending on how your movie works, but try this behavior (apply to a text member). It counts down, displays a word (such as "GO") for one more second then executes some command (such as to go to another marker or frame).


          ------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------ --------------

          property spriteNum, pMe, pMember, pStartingNumber, pTimer, pCurrentNumber, pEndingNumber, pDoString, pTimerCompleteMessage


          on beginSprite me

            pMe = sprite(spriteNum)

            pMember = pMe.member

            pCurrentNumber = pStartingNumber

            pMember.text = string(pCurrentNumber)

            pTimer = the milliseconds



          on exitFrame me

            if (the milliseconds - pTimer) / 1000 >= 1 then

              if pMember.text = pTimerCompleteMessage then

                do pDoString


                pTimer = the milliseconds

                pCurrentNumber = pCurrentNumber - 1

                if pCurrentNumber < pEndingNumber then

                  pMember.text = pTimerCompleteMessage


                  pMember.text = string(pCurrentNumber)

                end if

              end if

            end if



          on getPropertyDescriptionList

            description = [:]

            addProp description,#pStartingNumber, [#default:5, #format:#integer, #comment:"Starting Number"]

            addProp description,#pEndingNumber, [#default:1, #format:#integer, #comment:"Ending Number"]

            addProp description,#pDoString, [#default:"", #format:#string, #comment:"Do String"]

            addProp description,#pTimerCompleteMessage, [#default:"GO", #format:#string, #comment:"Timer Complete Message"]

            return description