4 Replies Latest reply on Apr 18, 2006 12:17 PM by Newsgroup_User

    Timing animation

      Ok im new to the whole lingo thing, i have an assignment that needs to be in soon and im stuck. I am making a game where birds fly across the screen and you have to shoot at them. The game has an introduction and then jumps to the actual game part. However i want the "game part" to only last say 30 seconds and then go to another marker or frame which will be the game over screen. Does that make sense? Could someone tell me the lingo to use to make the game last only 30 seconds. I am not allowed to use the timer in the behaviour library.
      cheers michael
        • 1. Re: Timing animation
          Level 7
          You probably have a score script that loops in place, this would be a
          good place to periodicly check the elapsed time.

          At the start of the game

          global startTime
          startTime = the milliseconds -- a running time counter


          on exitFrame
          global startTime
          if the milliseconds >= startTime + 30000 then
          -- end game code here
          else -- not done
          -- your game update code here
          --
          end if
          end
          • 2. Timing animation
            Cheers JB your a legend, i think i almost have it sorted. I used the code but it doesn't seem to be working but im pretty sure i have just made a couple of simple errors. Heres my code

            on enterFrame me

            global startTime
            startTime = the milliseconds -- a running time counter
            end

            on exitFrame me
            global startTime
            if the milliseconds >= startTime + 30000 then
            go to frame 105
            end if

            any pointers as to where i have messed up????
            • 3. Re: Timing animation
              ITS alright i got it sorted. I put it in the wrong place i reckon. Cheers for the help JB i appreciate it.
              • 4. Re: Timing animation
                Level 7
                In your code, I assume the first on enterFrame handler in run just once
                as the playback head passes it's frame, you could add a line to the
                second one to make it hold that frame until the 30 sec interval has
                passed.



                on enterFrame me

                global startTime
                startTime = the milliseconds -- a running time counter
                end

                on exitFrame me
                global startTime
                if the milliseconds >= startTime + 30000 then
                go to frame 105
                end if


                ---- revised code


                on exitFrame me
                global startTime
                if the milliseconds >= startTime + 30000 then go to frame 105
                else go to the frame -- loop here
                end
                1 person found this helpful