4 Replies Latest reply on Sep 27, 2010 5:59 AM by Ned Murphy

    Trying to make a game

    css141@gmail.com

      Okey so im trying to make a small flash game, so i can learn some more about flash....

      and i ran in to a small problem, in my game i would like there to be a time thats starts on 30 sec and going down to 0 sec, and when it hits 0 U have won and its sends U to the next lvl, in the game U need to avoid an enemy in the 30 sec.

       

      so this is what i need so far:

      timer there go´s from 30 sec to 0 sec and then sends U on to lets say frame 3

        • 1. Re: Trying to make a game
          Ned Murphy Adobe Community Professional & MVP

          Look at using the setInterval function to have it gradually change the value of a number that starts out at 30.

          • 2. Re: Trying to make a game
            css141@gmail.com Level 1

            well Im just startet at flash, so if U please could explain me what U want me to do, it would be nice.

            cos i realy have no idea what U are talking about

            • 3. Re: Trying to make a game
              dn0myar06

              create a dynamic text name your var _root.time (you can see it in properties)then convert it into a movie clip, name it timer


              go inside your mc, add frames depending on your fps..if your using 12 fps then you should have 12 frames for your dynamic text...add a new layer..it should be above the text layer, name it as action...at the end of the action's layer create a keyframe..it should be under 12th or 24th..depending on your fps...on that keyframe, put this code in your actions panel: _root.time--;

               

              Go back to your main timeline: make an if statement that will tell you that if _root.time is equal 0 then gotoAndPlay 3...

               

              I hope this could help you...
              • 4. Re: Trying to make a game
                Ned Murphy Adobe Community Professional & MVP

                If you are just starting with Flash and want to learn then what I want U to do is to learn how to use the Flash help documentation... before you do anything else.  It isn't likely you'll be able to do any more than copy what others have done if you do not learn how to look things up and learn for yourself.  So to start, open the Flash Help documentation (Help -> Flash Help) and look up the setInterval() function.  Before you worry about using it in your game, figure out how it works by reading about it and using it in a separate testing file.  Then think about how you can use it to reduce a value by one every second.

                1 person found this helpful