how to merge two modules into one bigger project

14
How to merge two modules into one bigger project A tutorial for using the Scratch Module Library 1 Yuan, [email protected]

Upload: stevie

Post on 16-Jan-2016

72 views

Category:

Documents


0 download

DESCRIPTION

How to merge two modules into one bigger project. A tutorial for using the Scratch Module Library. Step by Step Overview. Step 1 Know functionalities. Step 2 Import all modules. Step 3 Relocate broadcasts and “scene”. Step 4 House cleaning. Step 5 Test, test, test!. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: How to merge two modules into one bigger project

How to merge two modules into one bigger

project

A tutorial for using the Scratch Module Library

1Yuan, [email protected]

Page 2: How to merge two modules into one bigger project

Step by Step Overview

Step 1 Know functionalities. Step 2 Import all modules.

Step 3 Relocate broadcasts and “scene”.

Step 4 House cleaning.

Step 5 Test, test, test!

2Yuan, [email protected]

Page 3: How to merge two modules into one bigger project

To follow this example, download these two modules.m-effects-growhttp://scratch.mit.edu/projects/biy-modules/1446989m-voice-recognitionhttp://scratch.mit.edu/projects/biy-modules/1449171

Let’s Do An Example!

We will merge these two modules together.

3Yuan, [email protected]

Page 4: How to merge two modules into one bigger project

Step 1 Know functionalities.

m-effects-grow is a module that displays a title frame growing to the front of the screen. One can stop the module by pressing “space” key.

m-voice-recognition is a module that uses input voice loudness to detect number of syllables (one or two) and plays different music according to detected result. This module can be stopped by “space” key pressing.

Run each module and read the splash screen, know how each module starts and stops. Notice if one module is incompatible with another. (Conflicts on input/output, hardware requirements, etc.)

4Yuan, [email protected]

Page 5: How to merge two modules into one bigger project

Step 2 Import all modules.

Open one of the modules to be in the bigger project, and go to “Files\import project” and select all the other modules into this file.In this example, we will open the m-effects-grow module and import the m-voice-recognition module.

It has been reported that sometimes you could loose the comments in an imported project. If this happens, redo the “import” step or just copy the text of the comments from that original module.

5Yuan, [email protected]

Page 6: How to merge two modules into one bigger project

Save the file in a new name!

In this example, we will name the bigger project “t-merge-grow-voice” (“t” is for “test” ).

Step 2 Import all modules.

6Yuan, [email protected]

Page 7: How to merge two modules into one bigger project

Step 3 Relocate broadcasts and “scene”.

Decide the order you want to have the modules to run in. (Assume that all the modules are running in series, not parallel.)Go to “stage” and modify the code.

Guidelines:

The module splash screen should not show in a bigger project;

When green flag is clicked, one and only one module starts;

Operations between modules (scenes): “stop-last-scene” signal sent, “scene” changed to “next-scene”, “start-next-scene” signal sent;

The “scene” should be set to be the value that only enables the current scene (module).

7Yuan, [email protected]

Page 8: How to merge two modules into one bigger project

Step 3 Relocate broadcasts and “scene”.

In this example, we will let m-effects-grow go first, and m-voice-recognition next. Here are the changes we need to make to the script in “stage”.

Starting of the first module:

Connecting of two modules:

8Yuan, [email protected]

Page 9: How to merge two modules into one bigger project

Step 3 Relocate broadcasts and “scene”.

End of the project:

We have assumed in this example that the two modules are running one after another. But sometimes we would like to have two modules running at the same time (e.g. audio and video).Now how would you adjust the broadcast signals and “scene” variable changes in the “stage” and/or in individual module sprites so that more than one module can run in parallel in the bigger project?

9Yuan, [email protected]

Page 10: How to merge two modules into one bigger project

Step 4 House cleaning.

Read through the code, especially in the “stage”. Delete the unnecessary code and backgrounds.

In this example, these are the code we will throw away from the “stage”.

10Yuan, [email protected]

Page 11: How to merge two modules into one bigger project

Step 4 House cleaning.

Go to “Backgrounds” of “stage”. Delete all the “biy splash” backgrounds.

If you have backgrounds imported from different module stages that have a same name, Scratch will add a number to the name to differentiate them. Make sure you adjust the background switching accordingly.

11Yuan, [email protected]

Page 12: How to merge two modules into one bigger project

Step 4 House cleaning.

Other possible changes:

Check if more than one module have variables with the same name but mean different things. Make adjustments accordingly.......

Would this step be eliminated by making variables local when possible?

12Yuan, [email protected]

Page 13: How to merge two modules into one bigger project

Step 5 Test, test, test!

Now hit the green flag and see how it goes.

A checking list:

Is there any piece of code in an individual module running when the “scene” variable is not directed to this module? If there is, find out why and fix it!

If timer is used (especially when used in more than one modules), is it working (being reset and recorded) properly? If it isn’t, find out why and fix it!

Is there any conflict of operation of broadcast signals, variables, sensing, looks in the project? If there is, find out why and fix it!……

Don’t know why or how to fix it? Contact the people who made those modules. Their contact information is in the splash screen of the individual modules.

13Yuan, [email protected]

Page 14: How to merge two modules into one bigger project

Great job!

When you are done with testing the functionalities, it’s time to be creative and have fun!

Change the graphics to your taste.

Play with the parameters in the projects.

Add other modules or functions to your project.

Now it looks like your project!

Thank you very much for reading this tutorial with us. Have a question or suggestion? Please contact [email protected]. For more tutorials and information on the project, check http://build-it-yourself.com/biy-projects/proj-scratch-templates/index-scratch-templates.html.

14Yuan, [email protected]