Design and Dictionary

0 favourites
  • 5 posts
From the Asset Store
A collection of retro game sound effects made in classic style, including 111 sounds.
  • Hello community,

    So I have a little quest ahead, and I can think of a way to do it, but I do not know if this way would be the best and smarter, so I need some advice.

    I have several characters, and the screen where the player selects which one to play. You just swipe to the left or right to navigate through the characters, only one character appears on the screen at each time.

    Below the character there is a text indicating it's name, so the text changes at each character.

    How do I save all the names and display then according to the selected character?

    The way I am thinking is to have a Dictionary and save all the names, then get them through the keys. That's what I am trying to do now, but it is turning out to be not so simple as I expected because it needs Ajax (or am I wrong?) and I never used Ajax before.

    If this way is really the best way to do this, please can you explain me how to retrieve the values from the Dictionary Editor? Using ' Dictionary.Get ' doesn't work, I'm missing something.

    Thank you so much for your time and help :)

    Isaac

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you have not used a tool in Construct, the best is to first go through its manual article :

    Project file - construct.net/make-games/manuals/construct-3/project-primitives/files

    AJAX - construct.net/make-games/manuals/construct-3/plugin-reference/ajax

    And then, as can be seen in the how do I FAQ for C3 for example :

    construct.net/forum/construct-3/general-discussion-7/c3-missing-the-new-editors-124916

    You need to populate your dictionary first if you want to get data from it.

    To do so, you may add a json file to your project, and on start of your first layout, you ask, through AJAX, to retrieve its content.

    Once your dictionary is full, dictionary.get will return values as you intend.

    For your character selection screen though, you may want to use an array rather than a dictionary, since you can "apply" a name/image to a numeric value which may be easier to determine/navigate with your swiping interface.

    It makes it easier to add a character, and changing the order is just moving informations around in the original json file.

  • Kyatric thanks for your answer.

    I did read all this stuff already, and I did understood then, but the manual does not explain how to use the Dictionary object (it may explain here - construct.net/make-games/manuals/construct-3/plugin-reference/dictionary - but its very vague).

    I have already populated my dictionary through the Dictionary Editor.

    What I have now is:

    : On start of layout : Ajax : Request New Dictionary.json (tag "DictionaryFile")

    Dictionary : Load JSON string AJAX.LastData

    This is how the manual explains it.

    But when I try:

    : Every Tick : txt_Name : Set text to Dictionary.Get("0")

    It does not work. Any key that I put in Dictionary.Get will return zero, and the text will show 0.

    I'll be checking the use of Array for this, thanks again for your tip! But I still need to understand how to use the Dictionary properly.

    Isaac

  • This is how it should look like:

  • Oh God, that's what I was missing, the "On completed" event.

    Thank you kriand.

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