Speech Synthesis Demo button using construct 2

2

Stats

2,456 visits, 3,111 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 12 Aug, 2017. Last updated 19 Feb, 2019

Introduction

Constructor is based on 2D game creation, without using coding. Thus, it is easy for game development, it is similar to the time necessary to make your ideas a reality. Some of the initial concepts, using constructor for game creation are given below.

• It should be very friendly.

• It should contain a lot of export options.

• It should be inexpensive.

• It must be able to make creativity into a reality.

Prerequisites

• constructor-2(free edition), it can be downloaded from the link scirra.com

• Get license.

• Collect the game object (online-sprite).

Construction

This article concept is based on Speech Synthesis Demo Using a Construct 2,

Step 1:

Click File->New. Open NEW->Default new empty project.

Step 2:

An empty layout will be displayed and now we need to change the size of the layout in layout properties and the layout size must be (1000, 700) and a new Event sheet must be again added and named as game event.

Inserting many objects:

For adding the more object, double click->in layout sheet and->insert a new object dialog box and now we can select the more object.

Layout Sheet-> Inserting many object, given following template.

For Example:

1. Button

2. List

3. User Media

4. Text

5. Text box.

Step 4:

Now, we need to open the event sheets & right-click on the Window stage, & now again double click->event sheet and a window box will appear and select.

Add event->Click-On,

1. System

2. on start of layout

Add action->Click-On,

1st Conditions:

1. List

2. Clear

3. Done.

2nd Conditions:

1. List

2. Add item

3. “Default”

3rd Conditions:

1. List

2. Set Selection

3. Index: 0

Step 5:

Add action->Click on,

1. System

2. Repeat

3. UserMedia. VoiceCount

4. After, Done.

Add action->Click-on,

1. List

2. Text: UserMedia.VoiceLangAt (loop index) & ": " & UserMedia.VoiceNameAt (loop index) & " (" & UserMedia.VoiceURIAt (loop index) & ")"

3. Done.

Step 6:

Add event->Click-On,

1. User Media

2. Support Speech Synthesis

3. After, Done.

Add action->Click-On,

1st Conditions:

1. Speech Support

2. Set Text

3. Text: "Sorry, this browser does not support speech synthesis"

4. Done.

2nd Conditions:

1. Speech Support

2. Set font color

3. rgb(0, 0, 0)

3rd Conditions:

1. Speak

2. Set enabled

3. Mode: Disabled

4. Done.

Step 7:

Add Event->Click-On,

1st Conditions:

1. Speak

2. on-clicked

3. Done.

2nd Conditions:

1. List

2. Compare Selection

3. Done.

Add action->Click-on,

1. User Media

2. Speak Text

3. Text: SpeakText.Text

4. Rate: float (Rate. Text)

5. Pitch: float (Pitch. Text)

6. After, Done.

Step 8:

Add Event->Click-on,

1. System

2. Else

3. Done.

Add action:

1. User Media

2. Text: SpeakText.Text

3. Voice URI: UserMedia.VoiceURIAt (List.SelectedIndex - 1)

4. Rate: float (Rate. Text)

5. Pitch: float (Pitch. Text)

6. After, Done.

Step 9:

Again, Add Event->Click-on,

1. Pause

2. on-Clicked

1st Conditions:

Add action->Clicked-on,

1. User Media

2. Pause Speaking

3. After, Done.

Step 10:

Again, Add Event->Click-on,

1. Resume

2. on-Clicked

1st Conditions:

Add action->Clicked-on,

1. User Media

2. Resume Speaking

3. After, Done.

Finally, Speech Synthesis Demo Created on the layout sheet given template,

Output:

After, press F5 to run layout and Browser will display the following output.

Conclusion

Finally, we created Speech synthesis demo, using construct 2. We will see advanced game development concepts in the upcoming articles.

I hope this article will be useful. Thank you for reading,

  • 0 Comments

Want to leave a comment? Login or Register an account!