Help with an array

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hey guys. I feel kinda dumb right now because I've been trying all day long to figure something out that I think should be easy but I can't get it to work. I have an array populated with words such as "cat, dog, horse" etc... I want to associate each word in the array with a sound and then when the payer enters a word into a text box, if that word is contained in the array I can get the associated sound file to play (not right away, I would call it to play later). So the player types "cat" in the text box, and it remembers "meow.wav" and I can load and play that sound at a later time. If anyone would be willing to post an easy to understand capx of how to do that I would really appreciate it. This has been bugging me because it seems like it should be easy to do. Thank you very much.

  • s000.tinyupload.com/index.php

    just setup the height of the array to two and width to number of different animals

    You could take the easy way out and prevent the second dimension by just generating the wav-names out of the animal name. So in the example set next_sound to "sound_"&string&".wav" and next_sound would be sound_cat.wav for example.

    What's bugging me is: cat doesn't work, but dog and bird does. Also adding .wav behind woof would make the dog stop working as well. Really really weird. Maybe I did something wrong, but can't see the problem if there is one. (maybe someone can help)

    If you don't want the comparison to be case sensitive, compare the strings as lowercase (use lowercase(string))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much! This is very helpful!

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