Skip to content

Instantly share code, notes, and snippets.

@wastu01
Last active April 12, 2019 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wastu01/5a25807b40a49f90cdb09e4be440ff6d to your computer and use it in GitHub Desktop.
Save wastu01/5a25807b40a49f90cdb09e4be440ff6d to your computer and use it in GitHub Desktop.
按鈕競賽遊戲
var button;
/*宣告按鈕*/
boardReady({board 'Smart', url: '172.20.10.6'}, function (board) {
/*smart 用websucket 連線*/
board.systemReset();
board.samplingInterval = 50;
button = getButton(board, 4);
/*上拉按鈕開關=4*/
var btnGameNpcShow_ = document.getElementById("npcshow"),
/*略(1)*/
btnGameUserSpeed_;
/*設定相關變數 可以自行設定*/
btnGameStart_.className = "";
btnGameNpcImg_.setAttribute("src","https://thumbs.gfycat.com/MiserlyFocusedBeardeddragon.webp");
btnGameUserImg_.setAttribute("src","http://webduinoio.github.io/webduino-blockly/media/tutorials/run-man2.gif");
/*換圖片*/
btnGameGoal_.innerHTML = btnGameDistance_;
btnGameStart_.addEventListener("click",go);
/*按開始執行函數*/
function go(){
btnGameStart_.className = "go";
btnGameA_ = 0;
btnGameB_ = 0;
/*略(2)*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment