MakeCode Microbit 遊戲設計:「接雞蛋」(Microbit Game: Egg Catching)
首先來分析影片中遊戲的功能有哪些:
Game design:
- 角色「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.
步驟零:開啟 Makecode Microbit Editor (Step 0: open Makecode Microbit Editor
步驟一:建立新專案 (Step 1: Create 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)
步驟三:當Microbit啟動時(Step 3: When Microbit is on start)
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:
Originally published at https://yunlinsong.blogspot.com.