發表文章

目前顯示的是有「game」標籤的文章

MakeCode Microbit 雙按鈕PK遊戲

圖片
  LED 矩陣座標 首先要了解 Microbit LED 矩陣座標,由左到右的水平方向為稱為 X座標(下圖的藍色箭頭) ,由上到下的垂直方向稱為 Y座標(下圖的綠色箭頭) 。左上角白色箭頭所指的座標為(0,0),而正中央座標為(2,2)。 步驟一:建立一個新變數,名稱為 「球」 步驟二: 將 「球」 的起點放在正中央(如下圖) 步驟三: 按鈕A按下時, 「球」 往左移(-1) 步驟四: 按鈕B按下時, 「球」 往右移(1),請思考如何做? 步驟五: 當 「球」 碰到最左邊邊緣時(x=0) 步驟六: 當 「球」 碰到最右邊邊緣時(x=4) ,請思考如何做? 步驟七: 自動判斷勝負 提示判斷球的座標在那兒是按鈕A獲勝,請思考如何做? 範例連結: https://makecode.microbit.org/ _HKH8H6cM7ARu 若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。 If you like this post, please click the ads on the blog or  buy me a coffee . Thank you very much.

Scratch 3:點爆氣球 Balloon Clicker

圖片
【遊戲名稱】點爆氣球 Balloon Clicker 【基本動作】 氣球在畫面上隨機移動。 點擊氣球時,氣球會充氣(放大)。 氣球充氣到一定程度大小,會爆炸。 【遊戲試玩】 製作步驟: ( 底下程式積木僅供參考,設計方式不是只有一種。 ) 步驟 一 、選擇主要角色,本例為氣球(Balloon)。 步驟 二 、使用橡皮擦/擦子(Eraser)工具製作氣球爆掉的造型。 步驟 三 、為 氣球(Balloon)角色的 造型命名,分別為「 未爆 」、「爆了」。 步驟 四 、建立 氣球(Balloon)角色 積木程式 恭喜您完成了。 可增加的額外功能: 計時與 計分 專案範例網址: https://scratch.mit.edu/projects/719065015 若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。 If you like this post, please click the ads on the blog or  buy me a coffee . Thank you very much.

mBot 遇上打磚塊,來運動囉。

圖片
修改文部落格的文章 Scratch 遊戲:打磚塊 後,就可以用 mBot 裡的超音波來玩打磚塊遊戲了。只把 打磚塊 遊戲中平台角色的程式積木 換成用超音波的距離偵測 這裡只對座標轉換的方式做點說明: 1. 限制超音波所感測到的距離在30公分以下。 2. Scratch的水平畫面(X座標)寬度為 480 (從 -240 到 240 )。 3. 於是 超音波所感測到的 距離 * 16 - 240 就會是 ( -240 到 240 )了。 底下用手拿書本來玩的影片: 若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。 If you like this post, please click the ads on the blog or  buy me a coffee . Thank you very much.

First NDS Programming Project: hello nds

圖片
div>此篇文章介紹如何在 Windows 系統上建立 Nintendo DS 的遊戲程式開發環境。 This post introduces "how to setup  Nintendo DS  game programming development environment on Windows". 步驟一:安裝 devkitPro Step 1: Install devkitPro 可至 https://github.com/devkitPro/installer/releases/tag/v3.0.3 下載。 Go to  https://github.com/devkitPro/installer/releases/tag/v3.0.3  to download.  安裝方式可參考此影片 Watch this video to install devkitPro 在選擇 Choose Components 時,請將 NDS Development 勾選。 Check the NDS Development in "Choose Components" window.  步驟二:下載模擬器與韌體 Step 2: Down DS emulator and firmware DS的模擬器有好幾款 ,而筆者選用 melonDS  ,下載解壓縮即可。 There are serveral emulator for NDS . We could choose  melonDS . Just download it and extract it. 至  https://emulation.gametechwiki.com/index.php/Emulator_Files#Nintendo_DS_.2F_DSi  下載 DS BIOS 與 firmware 檔案。 Go to  https://emulation.gametechwiki.com/index.php/Emulator_Files#Nintendo_DS_.2F_DSi  to download BIOS and firmware binary files. 步驟三:設定 melon ...

MakeCode Microbit 遊戲設計:貓追老鼠遊戲(Microbit Game: Cat Chasing Mouse Game)

圖片
本篇文章將講解如何製作一個簡易追逐遊戲:【貓追老鼠】。 In this post, we're going to create a a simple chasing game: "cat chasing mouse", where you tilt the microbit to control a cat which is chasing a blinking mouse on the LED screen. 一、遊戲功能如下(Game Design):   遊戲時間一分鐘。One minute game. 遊戲開始時,貓在畫面正中央。The cat is at the screen center when the game on start. 老鼠不停閃爍,老鼠跑到隨機位置。The mouse is blinking and at random position on the screen. 板子往上傾斜時,貓往上移動。The cat move up when tilting the microbit front. 板子往下傾斜時,貓往下移動。The cat move down when tilting the microbit back. 板子往右傾斜時,貓往右移動。The cat move to right when tilting the microbit to the right. 板子往左傾斜時,貓往左移動。The cat move to left when tilting the microbit to the left. 貓捉到老鼠時,得一分,老鼠跑到隨機位置。 When the cat catches the mouse, the mouse runs to random position. The player scores 1 point. 二、積木程式(Blocks Code) 遊戲時間一分鐘。One minute game. 遊戲開始時,貓在畫面正中央。The cat is at the screen center when the game on start. 老鼠不停閃爍,老鼠跑到隨機位置。The mouse is blinking and at random position on the screen....

MakeCode Microbit 遊戲設計:簡易射擊遊戲(Microbit Game: Simple Shooting Game)

圖片
本篇文章將講解如何製作一個簡易射擊遊戲。 一、遊戲功能如下(Game Design): 砲台在畫面下方移動。The turret moves between the bottom of LED matrix. 按A鍵砲台燈向左移動。 The turret moves to left when button A is pressed. 按B鍵砲台燈向右移動。The turret moves to right when button B is pressed. 按A+B鍵發射子彈。Firing when button A and button B are pressed. 敵機隨機在最上方的位置出現。 The enemy moves between the top of LED matrix. 子彈打到敵機時,得一分。Score 1 point when the enemy is hit by a bullet. 二、積木程式(Blocks Code) 遊戲啟動時(On Start): 敵機隨機在最上方的位置出現。 The enemy moves between the top of LED matrix. 砲台在畫面下方移動。The turret moves between the bottom of LED matrix. 按A鍵砲台燈向左移動。 The turret moves to left when button A is pressed. 按B鍵砲台燈向右移動。The turret moves to right when button B is pressed. 按A+B鍵發射子彈。Firing when button A and button B are pressed. 子彈打到敵機時,得一分,。Score 1 point when the enemy is hit by a bullet. 三、結果(The Results) 影片(Demo Video): 請自由發揮額外功能,例如玩家生命等。 More Ideas examples: player's life...etc.  範例網址(Example Code): https://makecode.microbit.org/_EEAd7hdq8hav 若您覺得文章寫得不錯,請點選文章上的廣...

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

圖片
小編曾做過 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: 角色「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 ...

Microbit 遊戲設計:誰是快手高手(Microbit Game Design: Who's The Fastest Clicker)

圖片
本篇文章將講解如何製作一個簡易的兩人按鈕競賽遊戲:誰是快手高手。 This article will create a simple two players microbit game: Who's the fastest clicker.  一、遊戲功能如下(Game Design): 遊戲開始時將球放在LED矩陣正中央的x,y座標(2, 2)上。Light up the LED at (2,2) when the game started. 按下A按鈕時,球往左移動。The ball moves to the left when the button A is pressed. 按下B按鈕時,球往右移動。The ball moves to the right when the button B is pressed. 碰到牆壁時,有兩種情況:There are two conditions when the ball hits the edge: 1. 左邊牆壁,球的x座標等於0時,球的y座標減 1 ,球的x座標設為4。Left edge: when the ball's x equals to 0, ball's y minus 1 and assign ball's x to 4. 2. 右邊牆壁,球的x座標等於4時,球的y座標加 1 ,球的x座標設為0。Right edge: when the ball's x equals to 4, ball's y plus 1 and assign ball's x to 0. 當球的座標為(0,0)或(4,4)時,遊戲結束。When the ball is in (0,0) or (4,4), the game is over. 二、積木程式(Blocks Code) 遊戲開始時將球放在LED矩陣正中央的x,y座標(2, 2)上。Light up the LED at (2,2) when the game started. 按下A按鈕時,球往左移動。The ball moves to the left when the button A is pressed. 碰到左邊牆壁,球的x座標等於0時,球的y座標減 1 ,球的x座標設為4。Left edge: w...

Microbit 遊戲設計:猜數字遊戲(Microbit: Number Guessing Game)

圖片
本篇文章將講解如何製作一個簡易的猜數字遊戲。 This post introduces how to create a simple number-guessing game with Microbit. 一、遊戲功能如下:The game functions: 遊戲一開始自動產生一個 0 - 9 的數字讓使用者猜猜看。Pick a random from 0 to 9 when the game starts.  A 按鈕使用者猜數字,每按一次則加 1。Plus one to user's guess when button A is pressed. B 按鈕使用者猜數字,每按一次則減 1。Minus one to user's guess when button B is pressed. A + B 按鈕比較結果,使用者猜對時,遊戲重頭開始。When button A and button B are pressed, check the result. If the user's guess is correct, the game restarts. 二、積木程式 The Blocks 先使用 Make a Variable 來建立兩個變數: answer 與 guess 。 Click  Make a Variable  to create two variables: answer  and  guess . 遊戲一開始自動產生一個 0 - 9 的數字讓使用者猜猜看。  Pick a random from 0 to 9 when the game starts.  A 按鈕使用者猜數字,每按一次則加 1。 Plus one to user's guess when button A is pressed. B 按鈕使用者猜數字,每按一次則減 1。 Minus one to user's guess when button B is pressed. A + B 按鈕比較結果,使用者猜對時,遊戲重頭開始。 When button A and button B are pressed, check the result. If the user's guess is correc...

Scratch 3 遊戲:電流急急棒 ( Scratch Game: Wire Loop )

圖片
若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。 【遊戲名稱】 電流急急棒 【基本動作】 當急急棒角色被點擊時 ,急急棒角色會跟著滑鼠移動。 碰到電流角色 --> 遊戲結束。 碰到終點角色 -- > 闖關成功。 【玩法】 使用滑鼠移到 急急棒角色 ,按下滑鼠左鍵點擊 急急棒角色 ,放開滑鼠左鍵,即可控制 急急棒角色 。 製作步驟: ( 底下程式積木僅供參考,設計方式不是只有一種。 ) 步驟 一 、開啟 Scratch ,刪除貓咪角色。 步驟 二 、在舞台的背景,畫電流, 有兩種背景。 積木程式如下: 步驟 三 、畫新角色,名稱為 終點 。 此範例用綠色長方形,沒有積木程式。 步驟 四 、畫新角色,名稱為 急急棒 。 當急急棒角色被點擊時 ,急急棒角色會跟著滑鼠移動 ( 使用廣播訊息 ) 。 積木程式如下: 額外功能: 限時,時間倒數,時間到,停止遊戲。 專案範例網址: https://scratch.mit.edu/projects/252457534