← 返回资讯屏轩教育 · 行业资讯

一、Scratch编程环境与舞台坐标系 | The Scrat

2026-08-06 14:48 · 本文部分内容由AI辅助创作
KS3 Computing Scratch项目:从零开始学编程

KS3 Computing Scratch Projects: Learn Programming from Scratch

在英国KS3(Key Stage 3,对应7-9年级)的Computing课程中,Scratch是学生学习编程思维的核心工具。Scratch由MIT媒体实验室开发,采用拖拽式积木编程,让学生无需记忆语法就能专注于逻辑构建。本文系统讲解KS3 Scratch项目中的关键知识点,帮助学生在课堂项目与课后练习中打下扎实基础。

In the UK KS3 (Key Stage 3, Years 7–9) Computing curriculum, Scratch serves as the core tool for students to learn computational thinking. Developed by the MIT Media Lab, Scratch uses drag-and-drop block-based programming, allowing students to focus on logic building without memorising syntax. This article systematically explains the key knowledge points in KS3 Scratch projects, helping students build a solid foundation for classroom projects and independent practice.

一、Scratch编程环境与舞台坐标系 | The Scratch Environment and Stage Coordinates

Scratch界面分为五个核心区域:舞台(Stage)、角色列表(Sprite List)、积木面板(Block Palette)、脚本区(Scripts Area)和背景编辑区(Backdrops)。理解每个区域的功能是高效编程的前提。

The Scratch interface consists of five core areas: the Stage, Sprite List, Block Palette, Scripts Area, and Backdrops. Understanding the function of each area is a prerequisite for efficient programming.

舞台坐标系统 | The Stage Coordinate System

Scratch舞台是一个480×360像素的网格。X轴范围从-240(最左)到240(最右),Y轴范围从-180(最下)到180(最上)。舞台中心坐标为(0, 0)。在KS3课堂项目中,学生需要熟练掌握"go to x: y:"和"glide to x: y:"积木来控制角色移动。例如,让角色从左上角(-200, 150)滑行到右下角(200, -100)需耗时若干秒——这就是glide积木的典型应用场景。

The Scratch stage is a 480×360 pixel grid. The X-axis ranges from -240 (far left) to 240 (far right), and the Y-axis from -180 (bottom) to 180 (top). The stage centre is at (0, 0). In KS3 classroom projects, students need to master "go to x: y:" and "glide to x: y:" blocks to control sprite movement. For example, moving a sprite from the top-left (-200, 150) to the bottom-right (200, -100) over a few seconds — this is a typical use case for the glide block.

二、顺序结构与绿旗启动事件 | Sequence Structure and the Green Flag Event

顺序结构是编程最基础的概念——积木从上到下依次执行。在Scratch中,所有脚本必须从事件积木(Event Blocks)开始。最常用的是"when green flag clicked",点击绿旗后触发下方所有积木按顺序运行。

Sequence structure is the most fundamental programming concept — blocks execute in order from top to bottom. In Scratch, all scripts must begin with an Event Block. The most commonly used is "when green flag clicked", which triggers all blocks below to run in sequence when the green flag is clicked.

初始化:为什么每次开始前都要"归位"? | Initialisation: Why Reset Before Every Start?

KS3考试中经常出现的一个得分点是初始化(Initialisation)。在绿旗脚本的开头,必须显式设置角色的初始位置、方向、大小、造型和可见性。例如:

A common scoring point in KS3 assessments is initialisation. At the start of the green flag script, you must explicitly set the sprite's initial position, direction, size, costume, and visibility. For example:

缺少初始化是KS3学生最常见的失分原因——游戏第二次运行时角色位置或大小不对,就是因为状态没有重置。

Missing initialisation is the most common reason KS3 students lose marks — the sprite's position or size is wrong the second time the game runs because its state was not reset.

三、循环:Repeat、Forever与Repeat Until的区别 | Loops: Repeat, Forever, and Repeat Until

循环(Loop/Iteration)是KS3 Computing大纲中的核心概念。Scratch提供三种循环积木,各自适用于不同场景:

Loops (Iteration) are a core concept in the KS3 Computing curriculum. Scratch provides three loop blocks, each suited to different scenarios:

🔹 repeat (10) — 已知执行次数 | Known count: 例:画正方形旋转4次 | e.g. Draw a square, repeat turn 4 times

🔹 forever — 持续检测或动画 | Continuous checking: 例:检测是否碰到边缘 | e.g. Check if touching edge

🔹 repeat until <condition> — 满足条件前持续执行 | Stop on condition: 例:移动直到碰到颜色 | e.g. Move until touching a colour

特别注意:forever循环必须搭配条件判断使用,否则程序将永远无法退出。在KS3项目如迷宫游戏中,典型的用法是"forever + if touching colour + stop all"来检测角色是否走到终点。

Important note: the forever loop must be paired with a conditional check, otherwise the program can never exit. In KS3 projects such as maze games, a typical pattern is "forever + if touching colour + stop all" to detect when the sprite reaches the finish line.

四、条件判断与碰撞检测 | Conditionals and Collision Detection

条件判断(Selection)让程序根据不同的情况执行不同的代码。Scratch提供if和if-else两种结构,配合六边形布尔积木使用。KS3阶段重点掌握以下检测积木:

Conditionals (Selection) allow the program to execute different code based on different situations. Scratch provides if and if-else structures, used with hexagonal Boolean blocks. At KS3 level, focus on mastering these sensing blocks:

迷宫游戏的碰撞逻辑 | Collision Logic in Maze Games

在KS3典型项目"迷宫游戏"中,碰撞检测逻辑如下:按下方向键后角色移动几步,然后用if touching color [墙壁颜色]判断是否撞墙。若撞墙则后退相同步数,实现"碰到墙就弹回"的效果。这种"move → check → undo if needed"的模式是KS3阶段最重要的id

五、变量:计分、计时与生命值系统 | Variables: Score, Timer, and Lives Systems

变量(Variable)是存储数据的容器。在Scratch中创建变量时需要选择作用域——"For all sprites"(全局变量)或"For this sprite only"(局部变量)。KS3课堂中,计分板(Score)必须设为全局变量,因为所有角色都可能修改分数;而角色的私有状态(如弹药数)可以用局部变量。

A variable is a container for storing data. When creating a variable in Scratch, you need to choose its scope — "For all sprites" (global) or "For this sprite only" (local). In KS3 classrooms, the scoreboard must be a global variable because all sprites may modify the score; a sprite's private state (such as ammo count) can be a local variable.

计分系统的实现步骤 | Implementing a Scoring System

  1. 创建全局变量 Score | Create global variable Score
  2. 在绿旗脚本中 set Score to 0(初始化) | Initialise with set Score to 0
  3. 在收集到物品时 change Score by 1 | Increment by 1 when collecting an item
  4. 可选:用 wait until Score = 10 触发胜利条件 | Optional: trigger win condition with wait until Score = 10

同样地,计时器(Timer)变量可以用于限时挑战,生命值(Lives)变量管理游戏结束条件。三者结合可以构建出完整的游戏循环,这是KS3期末项目的常见要求。

Similarly, a timer variable can be used for time-limited challenges, and a lives variable manages the game-over condition. Combining all three can build a complete game loop — a common requirement for KS3 end-of-year projects.

六、广播机制实现角色间通信 | Broadcasting for Inter-Sprite Communication

广播(Broadcast)是Scratch中实现多角色协作的关键机制。一个角色发出broadcast [message],其他角色通过when I receive [message]来响应。广播是单向异步的——发送者不会等待接收者完成,这对于设计关卡切换、游戏结束提示等场景非常重要。

Broadcasting is the key mechanism in Scratch for multi-sprite collaboration. One sprite sends a broadcast [message], and other sprites respond with when I receive [message]. Broadcasts are one-way and asynchronous — the sender does not wait for receivers to finish, which is important for designing level transitions, game-over prompts, and similar scenarios.

broadcast与broadcast and wait的区别 | broadcast vs broadcast and wait

如果发送方需要等所有接收方执行完毕再继续,应使用broadcast [message] and wait。典型场景:游戏开始时先播放开场动画(broadcast "intro" and wait),动画结束后再进入游戏主循环。KS3考试常考的区分点就是这两个积木的适用场景。

If the sender needs to wait for all receivers to finish before continuing, use broadcast [message] and wait. A typical scenario: play an opening animation first (broadcast "intro" and wait), then enter the main game loop after the animation finishes. The distinction between these two blocks is a frequently tested point in KS3 assessments.

七、Scratch调试三步法与克隆管理 | Three-Step Scratch Debugging and Clone Management

调试(Debugging)是KS3 Computing的重要评估标准。推荐学生使用以下三步法:

Debugging is an important assessment criterion in KS3 Computing. Students are recommended to use this three-step method:

  1. 复现问题 | Reproduce:确定什么操作触发了错误 | Identify what action triggers the bug
  2. 隔离脚本 | Isolate:逐个点击脚本块运行,定位出错的积木 | Run script blocks one by one to locate the faulty block
  3. 逐步修复 | Fix:用"wait 1 secs"或"say"积木插入关键位置观察执行流程 | Insert "wait 1 secs" or "say" blocks at key points to observe execution flow

克隆体的创建与清理 | Creating and Cleaning Up Clones

克隆(Clone)是KS3进阶知识点。使用create clone of [myself]可以生成角色的副本,克隆体的脚本写在when I start as a clone下方。关键陷阱:克隆体不会自动消失,必须用delete this clone手动清理,否则舞台会累积大量不可见的克隆体导致性能下降。

Cloning is an advanced KS3 knowledge point. Use create clone of [myself] to generate copies of a sprite; clone scripts are written under when I start as a clone. Critical pitfall: clones do not disappear automatically — you must manually clean them up with delete this clone, otherwise the stage accumulates invisible clones, degrading performance.

📚 需要KS3/GCSE/A-Level一对一辅导?

Need KS3/GCSE/A-Level tutoring?
专业师资 · 中英双语 · 线上教学

📞 16621398022(同微信)

了解更多:aleveler.com

广告 / Sponsored
EIMIO32英寸4K移动随心智慧屏闺蜜机无线投屏直播娱乐健身随心屏天天平板电脑学习机显示器移动电视机闺蜜机
学习备考用品 · 正版现货 · 学习备考通用
查看详情 / View on Taobao
广告 / Sponsored
【加购10月16号李佳琦超级爆品节】KTC闺蜜机Pro+焕新版可移动平板电脑随心屏4K移动投屏护眼屏电视机看剧
学习备考用品 · 正版现货 · 学习备考通用
查看详情 / View on Taobao

更多咨询请联系16621398022(同微信)

备考资讯每日更新,关注不错过
考纲变化 · 科目分析 · 学习方法
扫码关注公众号 tutorhao
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图
公众号:tutorhao