How do I make construct 2 pick something out at random list

  • Hi, I'm a total noob at this, just started so please bear with me!

    I'm currently trying to make a hangman game, and I have a list of words I would like to put into the hangman game. But I want the words the player has to guess random. so basically i want the program to pick a word out from a word list, in a form I can make a hangman game out of.

    many thanks!

  • There's more than a few ways.

    For a shorter list this could work well:

    Set variable 'Word' to choose("apple","orange","banana")

    For a longer list you could

    1. Create a text file with all the words separated with commas.

    2. Add Ajax to the project and add the text file to your project files.

    3. On Start of layout -> Ajax Request Wordlist.txt (tag "GetList")

    4. Ajax On "GetList" completed -> Set variable 'Word' to tokenat(Ajax.LastData,round(random(tokencount(Ajax.LastData,","))),",")

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There's more than a few ways.

    For a shorter list this could work well:

    Set variable 'Word' to choose("apple","orange","banana")

    For a longer list you could

    1. Create a text file with all the words separated with commas.

    2. Add Ajax to the project and add the text file to your project files.

    3. On Start of layout -> Ajax Request Wordlist.txt (tag "GetList")

    4. Ajax On "GetList" completed -> Set variable 'Word' to tokenat(Ajax.LastData,round(random(tokencount(Ajax.LastData,","))),",")

    sorry but how do i do that?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)