3 Replies Latest reply on Mar 2, 2010 12:42 PM by Sean_Wilson

    How do I create a "command-line-interface" for a game?

    Slashydutchie

      Hey people,

       

      For a game I need to make a DOS-like command-line-interface where the user has at least 3 options to answer with, does anyone know how to go about this?

       

      Hope someone here can help me out!

       

      Kind regards,

      Angela

        • 1. Re: How do I create a "command-line-interface" for a game?
          Sean_Wilson Adobe Community Professional

          I don't understand what you mean by "at least 3 options to answer with" - can you explain in more detail, or provide an example use-case? Your command-line-interface might be a single Flash sprite, or ...

          • 2. Re: How do I create a "command-line-interface" for a game?
            Slashydutchie Level 1

            Well, the game is about an evil virus that wants to become cute. It communicates with the player through something similar to the old DOS-interface.

             

            What I want is for the "virus" to ask a question i.e. "What do you want to do now?" and the player to be able to answer in at least 3 commands i.e. "Hack"/"Research"/"Wait" which the program recognizes and upon entering the command sends the player to the appropriate next step, be it another question in the "conversation" or another window containing a puzzle-minigame.

            • 3. Re: How do I create a "command-line-interface" for a game?
              Sean_Wilson Adobe Community Professional

              I'm not sure what part of this you are having difficulty with. Imagine for a moment that instead of asking for your end user to type something into a text-entry field and to monitor what they type (perhaps when the ENTER key is pressed), that instead you provide 3 buttons on your stage. Responding to a button press in this scenario is much the same as responding to typed user input - your movie does something based on user interaction. Going back to the user entered text scenario, a text or field sprite can detect the ENTER key being pressed and examine the string the user has entered, something like:

              on keyDown me
                if _key.keyCode = 36 then
                  stopEvent
                  sText = sprite(me.spriteNum).member.text
                  case sText of
                    "hack": -- do whatever you need to here
                    "research":
                    "wait":
                    otherwise:
                  end case
                else
                  pass
                end if
              end