若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。
If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.首先來分析影片中遊戲的功能有哪些:
Game design:
步驟一:建立新專案 (Step 1: Create New Project)
步驟三:當Microbit啟動時(Step 3: When Microbit is on start)
程式範例網址(Blocks Code Example):https://makecode.microbit.org/_PVdiyw6TbfdW
- 角色「player」(就是玩家你囉),位在最下方的紅點。Player will be at (x, y) = (2, 4) when the game is started.
- 角色「egg」(從天而降的雞蛋),位於上方不停落下的紅點。Egg will be at (x, y) = (pick random 0 to 4, 0) when the game is started.
- A按鈕將「player」角色往左移動一格。When the A button is pressed, player moves to the left.
- B按鈕將「player」角色往右移動一格。When the B button is pressed, player moves to the right.
- 「player」角色接到「egg」角色時,會有動畫與音效,並得一分。When the player catches the egg, score 1 and perform some animation and play a melody.
- 雞蛋落到地面三次時,遊戲結束,並顯示Game Over,以及總得分。When the egg fall to the ground three times, the game is over. Show "Game Over" and total score on the screen.
製作步驟 Steps
步驟零:開啟 Makecode Microbit Editor (Step 0: open Makecode Microbit Editor
步驟一:建立新專案 (Step 1: Create New Project)
點選有 + 號的 New Project
Click the + symbol to create a New Project
專案名稱可用 CatchMe,按下 Create 按鈕
Give your project a name: CatchMe, click Create button.
步驟二:建立變數(Step 2: Make variables)
使用 Make a Variable 來建立兩個變數:egg 與 player 。
Click Make a Variable to make two variables: egg and player .
這兒有三件事要做,如下說明:
Three things to be done here, as the following descriptions:
- 角色「player」(就是玩家你囉),位在最下方的紅點。Player will be at (x, y) = (2, 4) when the game is started.
- 角色「egg」(從天而降的雞蛋),位於上方不停落下的紅點。Egg will be at (x, y) = (pick random 0 to 4, 0) when the game is started.
- 設定生命數為3。 Set 3 lives to the game.
步驟四:當按鈕按下時(Step 4: When a button is pressed)
這兒有兩件事要做,如下說明:
Two things to be done here, as the following descriptions:
- A按鈕將「player」角色往左移動一格。When the A button is pressed, player moves to the left.
- B按鈕將「player」角色往右移動一格。When the B button is pressed, player moves to the right.
步驟五:不停重複(Step 5: forever)
這兒有三件事要做,如下說明:
Three things to be done here, as the following descriptions:
- 雞蛋一秒下降一格。The egg moves down every second.
- 「player」角色接到「egg」角色時,會有動畫與音效,並得一分。When the player catches the egg, score 1 and perform some animation and play a melody.
- 雞蛋落到地面三次時,遊戲結束,並顯示Game Over,以及總得分。When the egg fall to the ground three times, the game is over. Show "Game Over" and total score on the screen.
Demo Video: