How do I use dictionaries to categorize words?

Get help using Construct 2

Post » Tue Dec 13, 2016 8:39 am

Here is my English grammar game:

https://drive.google.com/file/d/0BwoMdS ... sp=sharing

The idea is you type a sentence and then it breaks the words up into moveable sprites. I was wondering how to use a dictionary to change the background color of the sprites according to parts of speech. As it is right now they are all grey.

Let's say pronouns are the color blue, verbs green, and adjectives are red. So if I type in "he is tall" then when the sprites are made "he" has a blue background, "is" has a green one, and "tall" has a red one.

Any ideas for this? I know I can use the animation frames to change colors but I don't know how to set up a dictionary with the parts of speech and then have it read through them and change the frame accordingly.

Thanks,
Greg
B
12
S
2
Posts: 42
Reputation: 734

Post » Tue Dec 13, 2016 12:37 pm

Give them "instances" or "object names", where the key will have the desired behavior, like pronouns and so on..

For each type, one dictionary.

I would add with dictionary an array, maybe it turn things easy, but...

Check what key is being called with the word and change its color to the correspondent instance.

Something like this:
Condition: On word created;
Sub-Condition 1: Is instance (or object name) = "Pronouns";
Sub-Action 1: Change text color to red;
Sub-Condition 2: Is instance (or object name) = "Verb";
Sub-Action 2: Change text color to green;
etc...

Using an array within, you could check inside the array what word it was and setup accordingly its X,Y2.
Image
B
108
S
24
G
18
Posts: 1,373
Reputation: 22,824

Post » Fri Dec 23, 2016 11:25 am

Thank you sir I got it.

Tim Maia
B
12
S
2
Posts: 42
Reputation: 734


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 21 guests