Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is a Scratch Module An overview of Scratch modular programming specifications John, Yuan,

Similar presentations


Presentation on theme: "What is a Scratch Module An overview of Scratch modular programming specifications John, Yuan,"— Presentation transcript:

1 What is a Scratch Module An overview of Scratch modular programming specifications John, john@build-it-yourself.com Yuan, yuandong84@yahoo.com

2 Scratch Module Overview Modular coding enables you to: Create complex projects faster. Change code easily. Make your code more reliable. Module1Module2Module4 Stage Module3 www.Build-It-Yourself.com

3 Scratch Module Specs 1)Use common splash screen. 2)Use common input/output format. (API, Hooks) 3)Write short blocks of code. 4)Add comments. 5)Organize code layout logically. 6)File naming convention for templates “m-descriptive name” (module) “s-descriptive name” (story line) “g-descriptive name” (game) 7)Use original art work. 8)Use a stop script for every block of code. 9)Messages and variables should be unique and descriptive www.Build-It-Yourself.com

4 Scratch Module Test Procedure Target audience: 8-13 years intermediate Scratchers 1)Can it be edited in 5 minutes after opening the code. 2)Will it run without conflict in ‘module-test’ project. - Do all modules start when called? - Do all scripts stop when not needed? 3)Are messages and variables unique? - forbidden list: = time -> time-rocket-ctrl = start -> start-rocket-ctrl = go = end -> end-rocket-ctrl = stop 4) Are all blocks of code stopped when the module stops? www.Build-It-Yourself.com

5 Name: m-grow-title Function: Make a title frame grow across the screen Inputs: Receive broadcast "start-grow" Outputs: Broadcast "stop-grow“ Variables: scene = grow-title (module running) scene = 0 (module stopped) Yuan Dong - Nov 2010 yuandong84@yahoo.com

6 Module input / output Broadcast message, ‘start-module-name’ to start module main code. Broadcast message, ‘stop-module name’ when module stops executing. Variables (optional) Global scene variable that enables and disables module execution. Keyboard, mouse and other sensor inputs (optional) Scratch Module www.Build-It-Yourself.com

7 Module Stage Broadcast message, ‘start-next module name.’ Broadcast message, ‘stop-last module name.’ Global scene variable that monitors module execution. Module Stage The Module Stage starts and stops module execution. The ‘scene’ variable must be set in the stage before the “start” signal of a module is broadcasted. www.Build-It-Yourself.com

8 Scene Variable and Start / Stop Broadcast Messages The scene variable enables you to stop and start a module in the middle of execution. The scene variable should be set in the module stage so that when you import modules into the bigger project, all the scene variables will be changed in the same place. The scene variable should be the text name of the module. Set the scene variable to module name when you start the module. Set the scene variable to 0 when you stop the module. Make sure you set the scene variable before you broadcast a message to start the next module. www.Build-It-Yourself.com Stage of each module Time Set scene = mod-1 Broadcast start-mod-1 Set scene = next-scene Broadcast stop-mod-1 How to set them up in a single module Set scene = last-scene

9 Stage of the bigger project (with 10 modules) Set scene = mod-1 Time Broadcast start-mod-1 Set scene = mod-2 Broadcast stop-mod-1 Broadcast start-mod-2 Broadcast stop-mod-2 Set scene = mod-3 Broadcast start-mod-2 start Time Set scene = mod-10 Broadcast start-mod-10 Broadcast stop-mod-10 Set scene = end Broadcast stop-mod-9 end Scene Variable and Start / Stop Broadcast Messages How it looks in a bigger project

10 Module Stage www.Build-It-Yourself.com Example code in the module stage

11 Module Stage www.Build-It-Yourself.com Example code in the stage of the bigger project

12 Module Sprite Code www.Build-It-Yourself.com Example code in the module sprite

13 Modules: 3D Title Grow Landscape Outline Walker Rocket Control and Crash in a Scrolling Background Turn / Forward Rocket Control in a Static Background Up / Dwn / Rt / Lt Rocket Control in a Static Background Game Timer Alarm Clock Animated flying bird Avatar creator Voice recognition Mouse follower Jumping object Mini games Asteroids Pong Typing Game Skill Measuring Game 2-D Racing Game 3-D Racing Game Capture Game Trivia Game (with answers and score in a list) Dance Game Mario Game Modules and Mini Games to Make Under development of interns: Travis Ankit Yuan Connor Ayla Benjamin Thank you very much for reading this overview. Have a question or suggestion? Please contact yuandong84@yahoo.com or john@build-it-yourself.com. For more about the project, http://build-it-yourself.com/biy-projects/proj- scratch-templates/index-scratch-templates.html.


Download ppt "What is a Scratch Module An overview of Scratch modular programming specifications John, Yuan,"

Similar presentations


Ads by Google