内容简介
Scratch 是可视化的编程语言,其丰富的学习环境适合所有年龄阶段的人。利用它可以制作交互式程序、富媒体项目,包括动画故事、读书报告、科学实验、游戏和模拟程序等。《动手玩转Scratch2.0编程—STEAM创新教育指南》的目标是将Scratch 作为工具,教会读者最基本的编程概念,同时揭示Scratch 在教学上的强大能力。
《动手玩转Scratch2.0编程—STEAM创新教育指南》共分9章,前三章讲解如何使用Scratch 绘制几何图形,并创建富媒体应用程序,其余章节使用Scratch 讲解各个编程概念。每一章都有许多完整的案例,读者可以模仿它们制作许多类似的程序。当读完整《动手玩转Scratch2.0编程—STEAM创新教育指南》后,相信你一定可以亲自完成各种编程项目。
作者简介
Majed Marji 拥有韦恩州立大学的电子工程博士学位和达文波特大学战略管理的MBA 学位。他在汽车行业工作超过15 年,开发了许多软件,涉及实时数据采集、设备控制、实验室管理、工程数据分析、嵌入式系统、远程信息处理、混合动力汽车,以及与安全相关的动力系统。Marji 博士还是韦恩州立大学电气工程系的兼职讲师,主要讲授通信工程、机器视觉、微处理器、控制系统,以及算法和数据结构等相关课程。
目录
致谢....................................................................................................V
本书介绍...........................................................................................VII
第1章 准备开始.................................................................................1
什么是 Scratch ..................................................................................2
Scratch 编程环境 ..............................................................................3
试一试 1-1 ......................................................................................3
舞台 .........................................................................................................4
角色列表 .................................................................................................5
试一试 1-2 ......................................................................................5
试一试 1-3 ......................................................................................6
积木区 .....................................................................................................7
试一试 1-4 ......................................................................................8
脚本区 .....................................................................................................8
试一试 1-5 ......................................................................................9
试一试 1-6 ....................................................................................10
造型标签页 ...........................................................................................10
声音标签页 ...........................................................................................11
试一试 1-7 ....................................................................................11
试一试1-8 ....................................................................................12
背景标签页 ...........................................................................................12
角色信息 ...............................................................................................13
试一试 1-9 ....................................................................................13
工具栏 ...................................................................................................14
绘图编辑器 ......................................................................................15
设置图像的中心 ...................................................................................15
试一试 1-10 ..................................................................................16
设置透明色 ...........................................................................................16
制作第一个 Scratch 游戏 .................................................................17
第一步:准备背景 ...............................................................................18
第二步:加入反弹板和小球 ...............................................................18
第三步:让角色动起来 .......................................................................19
试一试 1-11 ..................................................................................20
第四步:添加声音更有趣 ...................................................................21
Scratch 积木一览 ............................................................................22
算术运算符和函数 ...........................................................................23
算术运算符 ...........................................................................................23
随机数 ...................................................................................................24
数学函数 ...............................................................................................25
本章小结 ..........................................................................................25
练习题 .............................................................................................25
第2章 动作和绘图...........................................................................29
使用动作模块的积木 ........................................................................29
绝对动作 ...............................................................................................30
试一试 2-1 ....................................................................................31
相对动作 ...............................................................................................32
试一试 2-2 ....................................................................................34
其他动作积木 .......................................................................................34
画笔模块和一个简单的画图程序 ......................................................35
试一试 2-3 ....................................................................................36
神奇的重复执行 ...............................................................................37
试一试 2-4 ....................................................................................37
旋转的正方形 .......................................................................................39
试一试 2-5 ....................................................................................39
试一试 2-6 ....................................................................................40
图章积木 ...............................................................................................40
Scratch 项目 ....................................................................................41
猫咪收集钱袋 .......................................................................................41
试一试 2-7 ....................................................................................41
接苹果游戏 ...........................................................................................45
关于被克隆的角色 ...........................................................................48
本章小结 ..........................................................................................49
练习题 .............................................................................................50
第3章 外观和声音...........................................................................53
外观模块 ..........................................................................................54
切换造型创建动画 ...............................................................................54
试一试 3-1 ....................................................................................55
试一试 3-2 ....................................................................................56
让角色思考并说话 ...............................................................................56
图形特效 ...............................................................................................57
角色大小和可视状态 ...........................................................................57
试一试 3-3 ....................................................................................58
角色间的图层 .......................................................................................58
声音模块 ..........................................................................................59
播放音频文件 .......................................................................................59
试一试 3-4 ....................................................................................59
弹奏鼓声和其他声音 ...........................................................................60
创作音乐 ...............................................................................................61
试一试 3-5 ....................................................................................62
试一试 3-6 ....................................................................................62
控制音量 ...............................................................................................62
设计 .......................................................................................................62
Scratch 项目 ....................................................................................63
在舞台上跳舞 .......................................................................................63
烟花效果 ...............................................................................................67
本章小结 ..........................................................................................69
练习题 .............................................................................................69
第4章 过程......................................................................................73
消息的广播和接收 ...........................................................................74
发送消息和接收消息 ...........................................................................75
使用广播机制协调多个角色 ...............................................................76
将大型程序分而治之 ........................................................................78
使用广播模拟过程 ...............................................................................80
创建自己的积木块 ...............................................................................81
给积木块添加参数 ...............................................................................83
试一试 4-1 ....................................................................................87
过程的嵌套 ...........................................................................................88
试一试 4-2 ....................................................................................90
分析问题的思维方式 ........................................................................90
自顶向下分析 .......................................................................................91
试一试 4-3 ....................................................................................93
自底向上分析 .......................................................................................94
本章小结 ..........................................................................................96
练习题 .............................................................................................96
第5章 变量......................................................................................99
Scratch 的数据类型 .......................................................................100
参数凹槽与积木形状 .........................................................................100
数据类型的自动转换 .........................................................................101
变量详解 ........................................................................................102
什么是变量? .....................................................................................102
创建并使用变量 .................................................................................105
试一试 5-1 ..................................................................................108
变量的作用范围 .................................................................................108
修改变量的值 ......................................................................................111
绘制蜘蛛网 .........................................................................................112
绘制风车 .............................................................................................112
克隆体中的变量 .................................................................................113
试一试 5-2 ..................................................................................113
变量值显示器 .................................................................................116
在程序中使用变量值显示器 ............................................................117
欧姆定律模拟实验 .............................................................................117
串联电路模拟实验 .............................................................................119
试一试 5-3 ..................................................................................119
计算球体体积和表面积 ....................................................................121
试一试 5-4 ..................................................................................121
绘制玫瑰花瓣 .....................................................................................123
试一试 5-5 ..................................................................................123
葵花籽分布模型 .................................................................................125
试一试 5-6 ..................................................................................125
获得用户输入 ................................................................................127
读取数字 .............................................................................................127
试一试 5-7 ..................................................................................127
读取字符 .............................................................................................128
执行算术运算 .....................................................................................128
本章小结 ........................................................................................129
练习题 ...........................................................................................129
第6章 用逻辑做决定......................................................................133
比较操作符 ....................................................................................134
布尔表达式的求值 .............................................................................136
比较字符和字符串 .............................................................................136
分支结构 ........................................................................................138
如果…那么积木块 .............................................................................138
将变量作为标志 .................................................................................139
如果…那么否则积木 .........................................................................141
嵌套分支结构 .....................................................................................142
菜单驱动程序 .....................................................................................143
逻辑运算符 ....................................................................................144
且操作符(and) .................................................................................145
或操作符(or) ...................................................................................146
不成立操作符(not) ..........................................................................147
使用逻辑运算符检查数值范围 .........................................................148
Scratch 项目 ..................................................................................150
坐标猜测游戏 .....................................................................................150
试一试 6-1 ..................................................................................152
三角形分类游戏 .................................................................................152
试一试 6-2 ..................................................................................156
猫咪巡线 .............................................................................................156
试一试 6-3 ..................................................................................157
求解直线方程 .....................................................................................158
试一试 6-4 ..................................................................................162
其他应用程序 .....................................................................................162
本章小结 ........................................................................................162
练习题 ...........................................................................................162
第7章 深入循环.............................................................................165
循环结构 ........................................................................................166
重复执行直到积木 .............................................................................166
试一试 7-1 ..................................................................................168
将重复执行和如果…那么结合 .........................................................168
试一试 7-2 ..................................................................................169
停止积木 ........................................................................................170
试一试 7-3 ..................................................................................171
结束过程调用 .....................................................................................172
验证用户输入 .....................................................................................173
循环计数器 ....................................................................................174
密码验证 .............................................................................................174
灵活的循环计数 .................................................................................175
试一试 7-4 ..................................................................................175
循环的嵌套 ....................................................................................177
递归:调用自身的过程 ..................................................................179
试一试 7-5 ..................................................................................179
Scratch 项目 ..................................................................................181
模拟时钟 .............................................................................................181
试一试 7-6 ..................................................................................181
小鸟射击游戏 .....................................................................................183
试一试 7-7 ..................................................................................183
自由落体实验 .....................................................................................187
试一试 7-8 ..................................................................................187
试一试 7-9 ..................................................................................190
抛体运动模拟器 .................................................................................190
其他应用程序 .....................................................................................193
本章小结 ........................................................................................193
试一试 7-10 ................................................................................193
练习题 ...........................................................................................194
第8章 字符串处理.........................................................................197
字符串数据类型 .............................................................................198
特殊字符统计 .....................................................................................198
字符比较 .............................................................................................199
字符串操作示例 .............................................................................201
Igpay Atinlay .......................................................................................201
试一试 8-1 ..................................................................................201
单词修正 .............................................................................................203
试一试 8-2 ..................................................................................203
解密游戏 .............................................................................................205
试一试 8-3 ..................................................................................205
Scratch 项目 ..................................................................................208
射击游戏 .............................................................................................208
二进制数到十进制数转换 .................................................................211
试一试 8-4 ..................................................................................211
试一试 8-5 ..................................................................................212
试一试 8-6 ..................................................................................214
刽子手游戏 .........................................................................................214
试一试 8-7 ..................................................................................219
分数运算教学工具 .............................................................................220
试一试 8-8 ..................................................................................224
本章小结 ........................................................................................225
练习题 ...........................................................................................225
第9章 链表....................................................................................227
Scratch 的链表 ..............................................................................228
创建链表 .............................................................................................228
试一试 9-1 ..................................................................................230
链表的积木 .........................................................................................231
添加和删除 .........................................................................................231
插入和替换 .........................................................................................231
获得链表中的变量 .............................................................................232
包含积木 .............................................................................................233
边界检查 .............................................................................................233
试一试 9-2 ..................................................................................233
动态链表 ........................................................................................234
向链表填充用户输入 .........................................................................234
绘制柱状图 .........................................................................................236
数字链表 ........................................................................................239
寻找最值 .............................................................................................239
试一试 9-3 ..................................................................................239
试一试 9-4 ..................................................................................240
计算平均数 .........................................................................................240
搜索和排序 ....................................................................................241
线性搜索 .............................................................................................241
试一试 9-5 ..................................................................................241
频数统计 .............................................................................................242
试一试 9-6 ..................................................................................244
冒泡排序 .............................................................................................244
试一试 9-7 ..................................................................................246
寻找中位数 .........................................................................................247
Scratch 项目 ..................................................................................248
我是诗人 .............................................................................................248
四边形分类游戏 .................................................................................249
试一试 9-8 ..................................................................................249
试一试 9-9 ..................................................................................251
数学魔法师 .........................................................................................252
花的结构测验 .....................................................................................255
试一试 9-10 ................................................................................255
其他应用程序 .....................................................................................257
试一试 9-11 ................................................................................257
本章小结 ........................................................................................258
练习题 ...........................................................................................258
附录A 分享与合作..........................................................................261
创建 Scratch 账号 .........................................................................261
使用书包功能 ................................................................................264
创建项目 ........................................................................................266
创建新的项目 .....................................................................................266
项目再创作 .........................................................................................267
项目页 .................................................................................................268
分享项目 .............................................................................................268