How to highlight the text - actual word synchronized with sound..
jarko
Member Posts: 2
Hello,
I am creating an interactive book. How can i highlight the text, is there any solution? After pressing the play sound button, the text(and highlight effect) should be synchronized with the sound.
It's something like "read a book to me" with highlighted words.
Even if i use a lot of timers, how can i highlight only one word? How can i synchronize longer sequences of text with the sound?
Thanks
I am creating an interactive book. How can i highlight the text, is there any solution? After pressing the play sound button, the text(and highlight effect) should be synchronized with the sound.
It's something like "read a book to me" with highlighted words.
Even if i use a lot of timers, how can i highlight only one word? How can i synchronize longer sequences of text with the sound?
Thanks
Answers
Hi @jarko
One way to solve your problem:
Make your text as an image (whatever colour text you want and a transparent background) and place it in an actor on-screen.
Make a scene attribute (integer) and call it WordCount.
Make an actor the colour of the highlight you want, made to the standard depth to cover any word. Lets call it HL. In the prototype (the actor in the Inspector) put in its Rules:
Rule: When scene.wordCount = 1
Change Attribute self.HL.Alpha to 1
Otherwise
Change Attribute self.HL.Alpha to 0
Drag it onto the screen and place it over your first word. Adjust the width accordingly. Double-click it to go to the editor and unlock it to make it an instance.
Go back to the scene editor, and option-drag it to copy for each word, positioning accordingly as well as adjusting the width accordingly. When this has been completed, select the text actor and bring it to the front.
Open the actor editor of each highlight box and change its Alpha to 0. And each time, before moving onto the next, amend its Rules i.e for the second box,
Rule: When scene.wordCount = 2
Change Attribute self.HL.Alpha to 1
Otherwise
Change Attribute self.HL.Alpha to 0
and the third,
Rule: When scene.wordCount = 3
Change Attribute self.HL.Alpha to 1
Otherwise
Change Attribute self.HL.Alpha to 0
etc.
For the audio of the words, I guess its easier to work out when words start and for how long, until the next word starts, in an Audio Editor. Alternatively, you could just try trial and error in GameSalad Creator.
In Your Play Sound button, put in its Rules:
Play Music YourAudioTrack1
Change Attribute scene.wordCount to 1
Timer: After ---- time up to 2nd word
Change Attribute scene.wordCount to 2
Timer: After ---- time up to 3rd word
Change Attribute scene.wordCount to 3
--etc
A more accurate way would be to make the timer values based on the built-in scene.time attribute, but I'm guessing that you shouldn't have too much trouble about accuracy if there's no more than 40 words or so per page.
Hope that sorts it for you; it all seems a bit laborious but you'll soon get into the "logical swing" of it hopefully. :-)
PS A tip for you: once you've finished the first scene/page, duplicate it on the Home window for the next scene every time. This way you'll only need to adjust the audio track and width of the highlights, and a few tweaks to the Rules, not forgetting the new words image, and you're good to go.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps