magiccar 發表於 2018-2-10 00:29

轉貼: 程小奔+mBlock5快速使用指南

程小奔+mBlock5快速使用指南http://docs-for-mk.readthedocs.io/zh/latest/image/1.png文檔版本:v1.1日期:2018/2/2作者:Breloom適用軟體及版本:mblock5 Alpha.8寫在前面的話致程小奔的支持者們,感謝您對程小奔眾籌專案的支持。目前程小奔支援的軟體版本為mblock5 Alpha.8,該版本為公測版本,在正式版發佈之前,我們會持續地對軟體進行優化。在使用程小奔和mblock5的過程中如有任何疑問請加qq群591221475,我們會為您提供幫助。Alpha.8版本增加了很多特性和功能,該文檔以小項目的形式介紹mblock5的基本功能,希望這些項目能夠給大家帶來啟發和靈感,幫助大家創作自己的項目。軟體下載http://docs-for-mk.readthedocs.io/zh/latest/image/2.png請下載最新版本的軟體:Windows版本>> mBlock.v5.0.0-Alpha.8.exe
MACOS版本>> V5.0.0-Alpha.8.pkg軟體介面與名詞解釋http://docs-for-mk.readthedocs.io/zh/latest/image/3.png左邊為積木區,中間為腳本區,右邊為舞臺區。
[*]積木區: 提供程式設計所需的積木,可以按照分類及顏色查找需要的積木。
[*]腳本區: 程式的編寫區域,可以用將積木拖放到這個區域來編寫程式。
[*]舞臺區: 除了呈現作品之外,設備的連接與上傳,添加角色與背景等功能都在這個區域進行。
示例程式http://docs-for-mk.readthedocs.io/zh/latest/image/4.png http://docs-for-mk.readthedocs.io/zh/latest/image/5.pngAlpha.8版本新增了12個示例程式,該文檔使用的部分專案可以在示例程式中找到。連接設備在小程開機的狀態下,使用USB資料線或藍牙適配器與電腦連接.1) 打開mblock軟體,點擊“請連接設備”http://docs-for-mk.readthedocs.io/zh/latest/image/6.png2) 點擊“連接”http://docs-for-mk.readthedocs.io/zh/latest/image/7.png注:“COM3”為串口序號,不同系統及電腦會有所不同。直接點擊“連接”即可1、開始第一個專案——用按鈕切換表情 (入門)1) 將按鈕事件的積木拖到腳本區。http://docs-for-mk.readthedocs.io/zh/latest/image/8.png2) 添加聲音積木,選擇音效。http://docs-for-mk.readthedocs.io/zh/latest/image/9.png3) 點擊“上傳到設備“。http://docs-for-mk.readthedocs.io/zh/latest/image/10.png按下小程上的“按鈕A”,小程就會發出聲音。4) 添加圖案積木,選擇一個預設圖案,也可以使用滑鼠繪製自己喜歡的圖案。http://docs-for-mk.readthedocs.io/zh/latest/image/11.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/12.png5) 繪製更多表情,用按鈕A,B,C來控制吧!http://docs-for-mk.readthedocs.io/zh/latest/image/13.png小技巧:在積木上點擊右鍵可以複製腳本;在腳本區的空白處點擊右鍵,可以整理所有積木。http://docs-for-mk.readthedocs.io/zh/latest/image/14.png http://docs-for-mk.readthedocs.io/zh/latest/image/15.png6) 將程式上傳至設備中,保存你的程式。http://docs-for-mk.readthedocs.io/zh/latest/image/16.png7) 最後一步,將作品展示給身邊的人~2.創作動畫——搖晃彈力球 (入門)這個項目將會告訴你如何使用小程來創作動畫,還可以使用有趣的方式來觸發它:1) 該項目建議使用以下積木:http://docs-for-mk.readthedocs.io/zh/latest/image/17.png2) 在新建項目中繪製一顆軟軟的球,讓它看起來有一種趴在地上的感覺。http://docs-for-mk.readthedocs.io/zh/latest/image/18.png3) 繼續繪製它彈起來的樣子,和剛才的積木組合在一起,並將時間設定為0.3秒。http://docs-for-mk.readthedocs.io/zh/latest/image/19.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/20.png4) 繼續完善這組圖案,畫出彈力球從彈起到落地的整個過程。http://docs-for-mk.readthedocs.io/zh/latest/image/21.png5) 添加聲音與觸發事件。http://docs-for-mk.readthedocs.io/zh/latest/image/22.png6) 上傳程式,搖晃小程,看看發生了什麼。你可以將小程掛在身上,當你跳起的時候,彈力球也會跟著跳起來.小技巧: 1. 可以使用不同的事件來觸發動畫, 2. 可以通過改變持續時間來調整動畫播放的速度。3.並存執行——警報 (入門)將積木組合起來就形成了腳本。小程最多可以同時執行六個腳本。該套裝程式含了兩個腳本,一個腳本讓小程迴圈播放聲音,一個腳本控制小程在迴圈閃爍燈光:http://docs-for-mk.readthedocs.io/zh/latest/image/23.png小技巧: 再增加一個腳本就可以使用齒輪電位器來調節小程的音量。http://docs-for-mk.readthedocs.io/zh/latest/image/24.png注:齒輪電位器在小程的側面。http://docs-for-mk.readthedocs.io/zh/latest/image/25.png4.圖案座標 (中級)1) 該項目建議使用以下積木。http://docs-for-mk.readthedocs.io/zh/latest/image/26.png該積木可以讓圖案在指定的座標上顯示,座標以圖案左上角的位置為准。http://docs-for-mk.readthedocs.io/zh/latest/image/27.png小技巧:點開圖案編輯器的 “http://docs-for-mk.readthedocs.io/zh/latest/image/28.png ” 圖案即可顯示座標。2) 嘗試以下腳本,查看程式效果。http://docs-for-mk.readthedocs.io/zh/latest/image/29.png5.變數與座標——奔跑的兔子 (高級)感謝Ekime繪製的兔子圖案,與文檔作者共同完成了這一項目。使用變數的功能可以讓圖案做出移動的效果:1) 創建變數。http://docs-for-mk.readthedocs.io/zh/latest/image/30.pngmblock5的變數名只支援拉丁字母,不支援漢字,可以使用英文或中文拼音來為變數命名。http://docs-for-mk.readthedocs.io/zh/latest/image/31.png http://docs-for-mk.readthedocs.io/zh/latest/image/32.png2) 使用以下積木繪製一隻小兔子。http://docs-for-mk.readthedocs.io/zh/latest/image/33.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/34.png3) 將變數設置為圖案的x座標。http://docs-for-mk.readthedocs.io/zh/latest/image/35.png4) 增加一個用按鍵改變變數的腳本,觀察圖案位置的變化,當變數超過一定數值時,小兔子會從移動到螢幕外。http://docs-for-mk.readthedocs.io/zh/latest/image/36.png5) 完善腳本,通過圖案的切換和座標的改變讓小兔子跑起來。http://docs-for-mk.readthedocs.io/zh/latest/image/37.png http://docs-for-mk.readthedocs.io/zh/latest/image/38.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/39.png小技巧:複製圖案積木並修改的方式可以比較方便地製作動畫。6.顯示感測器的值 (中級)小程包含多個感測器,它們可以讓小程檢測周圍環境的變化,包括檢測響度,光線,姿態等,這裡提供兩種方式來獲取感測器的數值:1) 在設備連接的狀態下,勾選想要獲取的數值,將數值顯示在舞臺上http://docs-for-mk.readthedocs.io/zh/latest/image/40.png http://docs-for-mk.readthedocs.io/zh/latest/image/41.png2) 也可以使用以下腳本,將感測器的數值顯示在小程的螢幕上http://docs-for-mk.readthedocs.io/zh/latest/image/42.png http://docs-for-mk.readthedocs.io/zh/latest/image/43.png3) 將上一個程式上傳到設備中,對小程發出聲音,查看舞臺和螢幕上數值的變化吧小技巧:在重複執行中加入等待積木,可以讓螢幕顯示數值的變化慢一些http://docs-for-mk.readthedocs.io/zh/latest/image/44.png7.響度指示計 (中級)使用圖案座標和聲音感測器完成的小項目,可以將響度以動態的形式顯示在小程的螢幕上:1) 連接設備,勾選響度積木,查看當前環境的響度(不同環境下數值會有所不同)。http://docs-for-mk.readthedocs.io/zh/latest/image/45.png http://docs-for-mk.readthedocs.io/zh/latest/image/46.png2) 使用以下積木,繪製一個簡單的圖案。http://docs-for-mk.readthedocs.io/zh/latest/image/47.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/48.png3) 使用運算分類中的四則運算積木來對響度的數值進行計算。http://docs-for-mk.readthedocs.io/zh/latest/image/49.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/50.png4) 完成程式並上傳,嘗試對小程發出喊叫,查看效果。http://docs-for-mk.readthedocs.io/zh/latest/image/51.png小技巧:可以一邊觀察響度的變化一邊使用乘法積木來對數值進行調整。http://docs-for-mk.readthedocs.io/zh/latest/image/52.png8.躲避障礙物 (高級)該專案使用程小奔及其感測器,使用小奔的相關功能時,需要在軟體中添加小奔擴展http://docs-for-mk.readthedocs.io/zh/latest/image/53_01.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/53_02.png程小奔包含一個可以向前及向下撥動的顏色紅外感測器,該專案需要將顏色紅外感測器撥到前方,用來檢測程小奔前方的障礙物。http://docs-for-mk.readthedocs.io/zh/latest/image/53.png該感測器使用的積木會有感測器標識。http://docs-for-mk.readthedocs.io/zh/latest/image/54.png1) 該項目使用以下積木說明:在顏色紅外感測器的前方有障礙物時該積木的結果為真(true),沒有障礙物時結果為假(false)http://docs-for-mk.readthedocs.io/zh/latest/image/55.png左為紅外線接收,右為紅外線發射注:檢測障礙物的原理為紅外線反射,因此在檢測障礙物時,顏色越淺的物體距離越長,顏色越深的物體距離越短2) 完成以下程式,將障礙物防止在程小奔面前,觀察表情變化http://docs-for-mk.readthedocs.io/zh/latest/image/56.png3) 補全程式,讓程小奔在沒有障礙物時前進,有障礙物時右轉http://docs-for-mk.readthedocs.io/zh/latest/image/57.png9.與舞臺角色互動——使用廣播演奏樂器 (中級)使用廣播的功能可以讓小程與舞臺角色通訊,完成舞臺互動作品:http://docs-for-mk.readthedocs.io/zh/latest/image/58.png1) 創建新消息,讓小程按下按鈕A時發送廣播“A”。http://docs-for-mk.readthedocs.io/zh/latest/image/59.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/60.png http://docs-for-mk.readthedocs.io/zh/latest/image/61.png2) 添加角色,新增的角色會出現在舞臺區。http://docs-for-mk.readthedocs.io/zh/latest/image/62.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/63.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/64.png3) 點擊新角色drum(鼓),為角色drum編寫程式。http://docs-for-mk.readthedocs.io/zh/latest/image/65.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/66.png4) 點擊小程,將小程的程式上傳到設備,按下A鍵後角色drum就會通過電腦發出鼓聲。http://docs-for-mk.readthedocs.io/zh/latest/image/67.png http://docs-for-mk.readthedocs.io/zh/latest/image/68.png5) 用同樣的方法添加更多樂器的角色,為Panda開一場演唱會吧!http://docs-for-mk.readthedocs.io/zh/latest/image/69.png10.通訊變數與齒輪電位器 (高級)除了使用廣播之外,也可以使用通訊變數讓小程與舞臺互動。該專案可以通過小程的齒輪電位器來控制角色的大小:1) 創建通訊變數。http://docs-for-mk.readthedocs.io/zh/latest/image/70.pnghttp://docs-for-mk.readthedocs.io/zh/latest/image/71.png2) 將通訊變數設置為齒輪電位器的值。http://docs-for-mk.readthedocs.io/zh/latest/image/72.png3) 點擊Panda角色,在資料區域同樣出現了通訊變數P。http://docs-for-mk.readthedocs.io/zh/latest/image/73.png4) 將角色大小設置為通訊變數P。http://docs-for-mk.readthedocs.io/zh/latest/image/74.png5) 將小程的程式上傳到設備,並點擊綠旗,撥動齒輪電位器,觀察角色的變化。http://docs-for-mk.readthedocs.io/zh/latest/image/75.png交流與分享歡迎大家登陸程小奔官方論壇分享自己的作品,交流產品使用技巧:

magiccar 發表於 2018-4-10 22:40

mBlock V5 最新公測版

popopo 發表於 2019-3-17 22:45

真想擁有

magiccar 發表於 2019-3-18 01:26

popopo 發表於 2019-3-17 22:45
真想擁有

還會增加好多功能喔!
頁: [1]
查看完整版本: 轉貼: 程小奔+mBlock5快速使用指南