Assign Text Objects to Array for Random dialouge?

0 favourites
  • 7 posts
From the Asset Store
Animated Text
$3.99 USD
With AnimatedText behavior you can make an impression of the text being “typed live”.
  • OK! As I traverse the landscape of Construct 2 I am having a difficult time wrapping my head around the array node. Is it possible to take several text objects, assign them to an array, and randomly call them upon interaction?

    The basis of the game I am working on is like a quiz. the Goal is to have 25 variant questions and 5 People asking them. any Ideas? Thanks!

    ~~The New Guy.. haha

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, if you're just looking to store text, the array would be perfect. You could then pull the text from the array at random with something like:

    Array.At(int(random(Array.Width)))

    There are at least a couple ways to store questions and answers in the array as well. You could use the other axis (y,z) of the array to store more data.

    Or you could tokenize the strings, which is what I'd typically do. Basically, you could store the quiz questions like "An apple is what color?|Red|Orange|Yellow|Purple".

    Given that, you could use the tokenat() expression to get the multiple parts of the question/answer string.

  • Awesome! Now I just need to know how to push the text into the array. Thanks for the info!

  • I was working out creation of an example quiz game when I came across the following thread, where Yann kindly provides an example, using tokenat() ironically enough:

    http://www.scirra.com/forum/making-a-quiz-game_topic50656.html

    Perhaps that'll help ya get started. :)

  • Thanks a ton Ugotsta! you have been a great deal of help in handling this aspect of the design!

  • HI..

    Ugotsta

    This was a great help sample file - thanks

    But I have trouble in getting the vestern letter ? ? ? shown

    guess it somehow has to be formatted right in utf8 but dont know how

    Also ... how can I read/load the txt.file from a server

    REGARDS

    Flemming

  • To load a text file from a server use the AJAX object.

    If you have trouble with special characters, make sure you save the text file as utf-8 in a text editor like notepad.

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