How do I turn typed text into sprites?

Get help using Construct 2

Post » Wed Dec 07, 2016 10:30 am

For my English grammar game (super exciting, I know) I have a text box. I want to type in a sentence, for example "I love fishing" and I want to hit return and turn the individual words in that sentence into sprites.

So, after I hit return I have 3 different sprites, one that says "I", one that says "love", and one that says "fishing". Then you can move them around and rearrange the sentence and whatnot but I know how to do that part. I don't know how to get them from the text box to moveable sprites.

Any help would be much appreciated.

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

Post » Wed Dec 07, 2016 11:20 am

In this example I create a sprite with drag and drop behaviour and a text object with pin to behaviour, I then pin the text to the sprite. maybe this will help you. ;)
https://drive.google.com/file/d/0B2ztlk ... sp=sharing
B
13
S
3
G
2
Posts: 38
Reputation: 1,421

Post » Wed Dec 07, 2016 12:08 pm

Here's an update, its a bit rough and ready but does what you need, me thinks.
https://drive.google.com/file/d/0B2ztlk ... sp=sharing
B
13
S
3
G
2
Posts: 38
Reputation: 1,421

Post » Thu Dec 08, 2016 3:42 am

Thank you very much. That's exactly what I needed. It's hard to know where to start on these projects.

I took the example2 and I added a text box and changed it so that the text in the text box becomes the split text and it works great.

I ran into this problem now: if you type "I love watching TV" and hit enter it works, it makes each word a sprite. But then if I type in something different and shorter after it still reads that last sentence, so if I type in "I have" and it enter it will spit out "I" "have" "watching" "TV". I'm studying up on arrays and different stuff in your event sheet i didn't understand so hopefully I figure the answer on my own but I figured I would ask.

Thanks again, really appreciate it.
B
12
S
2
Posts: 42
Reputation: 734

Post » Thu Dec 08, 2016 4:08 am

Ahhhh okay I see now, it's making the sprites from the array, and they are still in the array from the sentence before. Answered my own question.

Thanks
B
12
S
2
Posts: 42
Reputation: 734

Post » Thu Dec 08, 2016 7:23 am

B
66
S
24
G
7
Posts: 1,515
Reputation: 11,041

Post » Thu Dec 08, 2016 4:56 pm

@korbaach Wow, that's fantastic. Thank you very much.

I see you randomly assigned colors to them with the animation frames on the sprites. I want to, and know I know I can, assign certain parts of speech to their own specific colors.

For example, I would want all pronouns to be blue. Pronouns being "I, you, he, she, it...etc". I can find a way to make them blue, but only because there aren't too many of them. I can say if text="you" or if text="he" then make it blue.....But with something where there are thousands of possibilities what would I do?

If I wanted all verbs to be red, there are thousands of verbs in English, so I can't just enter them in like I did with the blue pronouns. How would I go about that? If it's even possible

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


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, mickclarke, Yahoo [Bot] and 29 guests