Working with Tables // Wordgame
Hi.
I'm creating a wordgame with tables and could use some help!
I have created some words in tables and sorted them by the amount of letters. I have a 6-letter table, 7-letter table etc. Also I've made a "round rules" box in the upper corner, to determine how many letters and which word will be choosed for each round.
Let's say I have 10 words with 6 letters each, and want the word to be randomly chosen each time I start the game. I have created 6 actors, each for one letter.
My problem is this: whenever a word appear (let's say it's "salads"), I want each of my 6 actors to have their letters from the word in my table to appear. I want Actor 1 to have "S", Actor 2 to have "A", Actor 3 to have "L" and so on. For that, I have created a "display text" behaviour and added my table.
BUT when the word is randomly chosen each round, I have to make sure that my actors change their letters to the same word and not some other word. Is this possible?
And for those wondering, I made 6 actors separately because I want to be able to touch and interact with each one of them.
I've watched numerous tutorials and spent many hours trying to fix this, but I still can't do it.
Any help would be much appreciated!! Thank you for reading () () (*)
Comments
There are two ways to set this up:
Have each row of the table contain the letters for a single word. So if you were using 'salads' then row 1 col 1 would contain 's', row 1 col 2 would contain 'a', row 1 col 3 would contain 'l', etc. When it's time to display a word, use the concatenate function to join letters: tableCellValue(tableName,1,1)..tableCellValue(tableName,1,2)..tableCellValue(tableName,1,3), etc.
Use the Release Candidate and store each word in a single cell of a row. If you were using 'salads' then row 1 col 1 would contain 'salads' and row 2 col 1 would contain the next word, etc. Use the new text string functions to determine the length of a word, to display a specific letter (textSubString) in each actor, and to check for correct words.
Each time you want to select a word at random, change attribute game.word to random(1,tableRowCount(tableName)). Then use game.word for the row number in each DisplayText, textSubString(), etc. function. Optionally, delete that row after picking it so that words can't be re-used.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thank you so much! Will check it out!