Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. 知识库
  3. 二维积木
  4. 如果<>那么…否则…

如果<>那么…否则…

Scheduled Pinned Locked Moved 二维积木
1 Posts 1 Posters 847 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    creaticodeteacher2-mail
    wrote on last edited by admin
    #1

     

    先修科目

    • 组装积木
    • 积木——“如果<>那么”

     

    介绍

    在控制类别中有2个“如果<>那么…否则…”。一个是匚形积木,另一个是报表积木。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/02047e79-5174-4446-b7cc-5a9c4ad5db78.png" width="650" style="">
     

    这两个积木怎么用?

    匚形积木

    匚形积木检查条件真假。
    如果条件为“真”,就运行第一个匚形中的积木。 https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/61d4814c-7b88-4578-a719-dc9588466a02.png" width="100" style="">
    如果条件为“假”,就运行第二个匚形中的积木。https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/5d652de0-1d76-4f37-a577-2a9934d6e559.png" width="100" style="">

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/57568a2d-c7f4-468e-a86b-e4171c42bed0.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
     

    报表积木

    报表积木同样会检查条件真假。
    如果条件为“真”,就会取第一个输入框的值。https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/d6459509-4c58-461f-9a93-bb3791904fba.png" width="400" style="">
    如果条件为“假”,就会取第二个输入框的值。https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/0d121dbf-76ad-4269-a70f-5d7c2031cbfb.png" width="400" style="">

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/17fbb7a8-6ddb-405a-8f93-ebf807363682.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
     

    嵌套积木“如果<>那么…否则…”

    如果你把积木“如果<>那么…否则…”放在另一个中,就组成“嵌套”。https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/49d92f67-be36-4eba-a8bc-b582bebdefb9.png" width="150" style="">
    可以用嵌套的“如果<>那么…否则…”检查更多条件,要根据第一个条件真假。

    在如下例子中,第一个积木“如果”检查分数是否大于等于20。如果为真,背景就换成“2级”。否则,第二个积木“如果”检查分数是否大于等于10。如果为真,角色就说“干得漂亮!继续!”,否则就说“赶快”。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f1b1ee89-b8e0-4f20-9b75-29a846e4fec8.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
     

    多个“如果<>那么…否则…”

    为了逐个检查多个条件,你可以叠放多个“如果<>那么…否则…”。

    在如下例子中,如果角色碰到红球,就说“我找到红球了。”,否则就移动到随机位置。然后如果角色碰到黄球,就说“我找到黄球了。”,否则移动10步。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/2fc74573-8cbc-4f78-852f-32a593ebfb10.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
     

    重复检查条件

    积木“如果<>那么…否则…”只检查一次其布尔条件。在游戏或者项目中,如果你想重复不断检查条件,可以用积木“重复执行”或者“重复执行( )次”。

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3ccb688d-aabd-441f-b239-ea086f4c3fb6.gif" width="800" style="border-radius: 5px; border: 1px solid #29622d;">
     

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode