MakeCode Microbit 遊戲設計:「接雞蛋」(Microbit Game: Egg Catching)

若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。

If you like this post, please click the ads on the blog or buy me a coffee. Thank you very much.


小編曾做過 Scratch 遊戲:接雞蛋,而且最近剛好看到Youtube 上的影片:Micro:bit 創意遊戲:「接水果。於是來教大家自己用Microbit來做一個玩玩吧。The blog post: Scratch 遊戲:接雞蛋 created a egg-catching game. And there is a video on youtube: Micro:bit 創意遊戲:「接水果. So, this post will create a Microbit game: Egg Catching.

首先來分析影片中遊戲的功能有哪些:
Game design:
  1. 角色「player」(就是玩家你囉),位在最下方的紅點。Player will be at (x, y) = (2, 4) when the game is started.
  2. 角色「egg」(從天而降的雞蛋),位於上方不停落下的紅點。Egg will be at (x, y) = (pick random 0 to 4, 0) when the game is started.
  3. A按鈕將「player」角色往左移動一格。When the A button is pressed, player moves to the left.
  4. B按鈕將「player」角色往右移動一格。When the B button is pressed, player moves to the right.
  5. 「player」角色接到「egg」角色時,會有動畫與音效,並得一分。When the player catches the egg, score 1 and perform some animation and play a melody.
  6. 雞蛋落到地面三次時,遊戲結束,並顯示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 .



步驟三:當Microbit啟動時(Step 3: When Microbit is on start)
這兒有三件事要做,如下說明:
Three things to be done here, as the following descriptions:
  1. 角色「player」(就是玩家你囉),位在最下方的紅點。Player will be at (x, y) = (2, 4) when the game is started.
  2. 角色「egg」(從天而降的雞蛋),位於上方不停落下的紅點。Egg will be at (x, y) = (pick random 0 to 4, 0) when the game is started.
  3. 設定生命數為3。 Set 3 lives to the game.

步驟四:當按鈕按下時(Step 4: When a button is pressed)
這兒有兩件事要做,如下說明:
Two things to be done here, as the following descriptions:
  1. A按鈕將「player」角色往左移動一格。When the A button is pressed, player moves to the left.
  2. 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:
  1. 雞蛋一秒下降一格。The egg moves down every second.

  2. 「player」角色接到「egg」角色時,會有動畫與音效,並得一分。When the player catches the egg, score 1 and perform some animation and play a melody.

  3. 雞蛋落到地面三次時,遊戲結束,並顯示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:




程式範例網址(Blocks Code Example):https://makecode.microbit.org/_PVdiyw6TbfdW

沒有留言: