I’m making an Android App for my friends and family based on the game Taboo. Basically, the game displays a main word, and then a list of restricted words. The object is to get your teammates to say the main word, but you cannot say any of the restricted words.
For this app, I would need several hundred main words, plus 7 restricted words for each main word.
My issue is how to store these so they can be accessed by a randomly by the app.
My initial thought was to use an XML resource using string arrays, but I do not know how I would reference these with a random generator.
I am open to any and all suggestions. I am working in Eclipse using the Android SDK.
Just to clarify, I am experienced in Java/C/C++, but this is my first Android App. I have the game framework almost complete, and this is my only major issue.
Any help is appreciated.
You can use the xml method you said with a random. Something like this:
Lets say you have 1 string-array which contains the 8 words (1 correct and 7 restricted), you can have as many arrays with different names. They are saved in string.xml
Now in java create the
Randomand check what number you get, then if you get x number open x string-array.Here’s an example:
now in java:
then check your number:
or use any method you like, like
switch…Edit: or a trick can be to make names of string-array a# (Of curse # is a number) then do:
With this method you don’t need the
if elseorswitchor whatever you want to use.NOTE: this code is from my mind so it can have some writing errors.