2 Replies Latest reply on Apr 18, 2006 8:14 AM by Newsgroup_User


      Right i have made a game in director. It is made up of three parts, the introduction this then goes to the main game, and then goes to a gameover screen.

      the main game screen has a score field.
      The game over screen needs to have a final score field.
      How will i get the field in the gameover screen to display the final score achieved in the game part.

        • 1. Re: Variables
          Level 7
          Text and field members, the display element that you are using to show
          the score during play, can be used again in the game over section of
          your movie. Just drag another instance of that member, text or field,
          into the game over section of your movie.

          As the game is played and the score increments, the number displayed in
          the field or text sprite is actually being held in the text member that
          made that sprite. So if you place another instance on the stage, it will
          show the same content.

          Rob Dillon
          Adobe Community Expert

          • 2. Variables
            James Newton, ACP Level 3
            The simplest solution would be to use the same field in the gameover screen as in the main game screen.

            If you plan to have a high score field, and want the scores to appear in the correct order then you could:

            1. Load the scores into a sorted list
            2. Add the new score
            3. Use the handler below to convert the scores in the list to RETURN-delimited text.

            on ListToString(aList) -----------------------------------------------
            -- INPUT: <aList> must be a linear or property list
            -- OUTPUT: a string where each item of <aList> appears on a separate
            -- line
            -- NOTE: Contains no error checking

            aString = ""

            tCount = aList.count()
            repeat with i = 1 to tCount
            put RETURN & aList.getAt(i) after aString
            end repeat

            delete aString.char[1] -- initial RETURN char

            return aString
            end ListToString

            TIP: to show scores in reverse you can invert the sort order:

            vList = [1, 2, 3]
            vList = -vList
            vList = -vList
            put ListToString(vList)
            -- "3