mit-scratch - 嵌套的 "touching" block 有什么作用?

标签 mit-scratch

制作 Scratch 平台游戏时,我发现它符合我的要求:

enter image description here

...因为它似乎没有以适合我程序的节奏运行。

但是,这确实起作用了:

enter image description here

...我注意到它被用于 Sushi Platformer 等平台游戏。

有谁知道这些嵌套的触摸 block 实际上做了什么?

更新:

@towerofnix 是对的...我在 https://scratch.mit.edu/projects/118349555/#player 做了一个实验项目

...具有以下实验选项:

enter image description here

结果:

控制:平台检测有效,但上下抖动太多

实验 1(根据@towerofnix):有效,没有抖动!

实验 2:不起作用,企鹅有时会从地板上掉下来

实验 3:有效,因为它等同于实验 1!

最佳答案

Scratch 并不神奇。这是一个普通的代码解释器(据我所知)。

既然已经解决了这个问题,让我们成为解释者™ 并解决这个问题。

  1. touching-color 将返回 true 或 false。
  2. 然后触摸输入真或假。
  3. touching will go through all sprites named true or false.
  4. 因为没有使用这些名称的 Sprite (至少在寿司平台游戏中没有),继续。
  5. next is return false, so return false.
  6. 因此嵌套将始终返回 false。
  7. 不接受输入 false,所以它返回 true。
  8. 因此这 - - 是不必要的,可以用这个代替 -

因此,如果执行最后一步与不执行最后一步的结果不同,我们真的需要看看您的项目!

关于mit-scratch - 嵌套的 "touching" block 有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38921777/

相关文章:

microphone - 在 Scratch 中使用麦克风时出现问题

mit-scratch - Scratch 输出文件 .txt 或类似文件

mit-scratch - 即使触摸另一个 Sprite , Sprite 也会在 Scratch 中消失

mit-scratch - 为什么 Sprite 服装没有改变?

mit-scratch - MIT Scratch 功能 block

mit-scratch - 为什么随机选择不从头开始选择一些数字?

mit-scratch - 在 Scratch 上安装自定义字体

javascript - 转换 Scratch 颜色

variables - 为什么我的暂存云变量没有更新?