6 Replies Latest reply on Jan 24, 2007 5:09 AM by Newsgroup_User

    Countdown Timer

    Dava
      Hi,

      I'm trying to buld a countdown timer into a simple game. I'm using the built in 'Countdown Timer' behaviour in Director MX. When the timer reaches zero I want to jump to a specific marker. I thought this would be quite simple but I can't figure it out! I've tried to put ' Go to marker "xxxxx" ' into ' Message to send after countdown' but this didnt work.

      Any help greatly appreciated!
        • 1. Re: Countdown Timer
          otterman Level 1
          Use this as a frame script. Create a marker called "MYMarkerName" and watch it jump after its counted down.
          You should be able to work something this simple into your game. hope it helps

          ---counter script

          property pNumFrames

          on getPropertyDescriptionList
          dlist = [:]
          addProp dlist, #pNumFrames, [#default:32, #format:#integer, #comment:"num of frames"]
          return dlist
          end getPropertyDescriptionList




          on exitFrame
          if pNumFrames > 0 then
          pNumFrames = pNumFrames - 1
          go the frame
          else
          go to frame "MYMarkerName"
          end if
          put pNumFrames ----for your viewing
          end exitFrame
          • 2. Re: Countdown Timer
            Dava Level 1
            Thanks for that,

            Could you please tell me exactly where I need to put my script? Do I still need to use the Countdown Timer behaviour?

            Sorry, I'm stll a bit of a newbie......
            • 3. Re: Countdown Timer
              otterman Level 1
              Countdown Timer behaviour-NO! Use something like this, its simple and you can pick it apart and adapt it easily.

              You can use it in your score window by double clicking on a frame in the script line. You can also apply it to a member within your timeline/stage.

              Ive also set up a property for you to vary how long your counter counts down for- u can change this in the property inspector window-click on the behavior icon. Note-this is not in seconds (depends on your movie tempo/fps)

              You can also see it count down in the Message window.

              Once it has counted down to 0, it will jump to a marker called "MYMarkerName", so u gota create this marker.

              Savy?
              • 4. Re: Countdown Timer
                Dava Level 1
                Thanks,

                That all seemed to work. The problem is I need to show my countdown timer counting down in seconds, and going to a marker when it reaches zero. I also have to jump between several different markers during my game - the behaviour you suggested seems to pause on a frame unil the timer runs out.

                Is there a way of using the Countdown Timer behaviour to jump to a marker?

                Thanks for your help!
                • 5. Re: Countdown Timer
                  otterman Level 1
                  OK, ive done a quick amend here. Im sure there is a better way of doing it in a moviescript, but here gos anyway-

                  Apply this script to a sprite instead of in the timeline. You gonna have to give a 'go the frame' command sum where, otherwise its gonna run straight through! Dunno- Im guessing here!

                  Also the 'put pNumFrames /_movie.frameTempo' can be applied to a text member, so you can view this on stage!

                  ie,- 'put pNumFrames /_movie.frameTempo into member("mytextmember")'


                  ---counter script

                  property pNumFrames

                  on getPropertyDescriptionList
                  dlist = [:]
                  addProp dlist, #pNumFrames, [#default:100, #format:#integer, #comment:"num of frames"]
                  return dlist
                  end getPropertyDescriptionList



                  on exitFrame
                  if pNumFrames > 0 then
                  pNumFrames = pNumFrames - 1
                  --- go the frame ----YOU AINT GONNA NEED THIS
                  else
                  go to frame "MYMarkerName"
                  end if

                  put pNumFrames /_movie.frameTempo----for your viewing(CONVERTS THE FRAMES TO SECONDS)

                  end exitFrame
                  • 6. Re: Countdown Timer
                    Level 7
                    Check my answer in the basics thread.

                    regards
                    Dean

                    Director Lecturer / Consultant
                    http://www.fbe.unsw.edu.au/learning/director
                    http://www.multimediacreative.com.au