{"id":407681,"student_id":10,"content":"setBackdrop('bg.png');\nlet result = createSprite('result_0.png', 'result_1.png', 'result_2.png'); //完美、不錯、漏拍\nlet p1 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet p2 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet p3 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet p4 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet p5 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet p6 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet p7 = createSprite('k_0.png', 'k_1.png', 'k_2.png', 'k_3.png', 'k_4.png', 'k_5.png');\nlet n1 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png');\nlet n2 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png');\nlet n3 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png');\nlet n4 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png');\n\nresult.moveTo(600, 300);\np1.moveTo(150 * 7, 700);\np2.moveTo(150 * 6, 700);\np3.moveTo(150 * 5, 700);\np4.moveTo(150 * 4, 700);\np5.moveTo(150 * 3, 700);\np6.moveTo(150 * 2, 700);\np7.moveTo(150 * 1, 700);\nn1.moveTo(450, 430);\nn2.moveTo(550, 430);\nn3.moveTo(650, 430);\nn4.moveTo(750, 430);\n\nlet score = 0; //分數\nlet clock = 0; //遊戲迴圈次數\nlet beat = 30; //多少迴圈為一拍\nlet meter = 0; //第幾拍\nlet round = 0; //第幾節\nlet timer = 0; //目標時間\n\n// 遊戲主迴圈\nfunction gameloop () {\n \n print(clock, 10, 10, 'white', 20);\n print(meter, 10, 30, 'white', 20);\n print(round, 10, 50, 'white', 20);\n\n updateScore();\n\n if (clock == 0) {\n createSound('bgm.mp3', true);\n }\n\n clock += 1;\n\n if (clock % beat == 0) {\n \n meter += 1;\n if (meter == 1) playSound(p1);\n if (meter == 2) playSound(p2);\n if (meter == 3) playSound(p3);\n if (meter == 4) playSound(p4);\n if (meter == 5) playSound(p5);\n if (meter == 6) {\n playSound(p6);\n timer = clock + beat; //應該要按下的時機點\n }\n if (meter == 8) { //第 8 拍\n meter = 0;\n round += 1;\n\n p1.costumeId -= 1;\n p2.costumeId -= 1;\n p3.costumeId -= 1;\n p4.costumeId -= 1;\n p5.costumeId -= 1;\n p6.costumeId -= 1;\n p7.costumeId -= 1;\n \n if (round % 2 == 0) {\n p1.costumeId = Math.floor(Math.random() * 3) * 2;\n p2.costumeId = Math.floor(Math.random() * 3) * 2;\n p3.costumeId = Math.floor(Math.random() * 3) * 2;\n p4.costumeId = Math.floor(Math.random() * 3) * 2;\n p5.costumeId = Math.floor(Math.random() * 3) * 2;\n p6.costumeId = Math.floor(Math.random() * 3) * 2;\n p7.costumeId = Math.floor(Math.random() * 3) * 2;\n }\n }\n \n if (round == 2) beat = 60;\n if (round == 4) beat = 30;\n if (round == 6) beat = 15;\n if (round == 7) beat = 120;\n if (round == 8) beat = 60;\n if (round == 10) beat = 30;\n if (round == 12) beat = 15;\n if (round == 13) beat = 120;\n if (round == 14) stop();\n }\n}\n\n// 角色打擊樂器\nfunction playSound (sprite) {\n createSound('drum.wav');\n sprite.costumeId += 1; //切換角色造型\n}\n\n// 按下空白按鍵時\nfunction press () {\n playSound(p7);\n let diff = Math.abs(clock - timer);\n if (diff \u003c 5) {\n result.costumeId = 0;\n score += 10;\n } else if (diff \u003c 10) {\n result.costumeId = 1;\n score += 5;\n } else {\n result.costumeId = 2;\n score += 0;\n }\n}\n\n// 根據分數更新數字角色\nfunction updateScore () {\n n1.costumeId = Math.floor(score / 1000) % 10; //千位\n n2.costumeId = Math.floor(score / 100) % 10; //百位\n n3.costumeId = Math.floor(score / 10) % 10; //十位\n n4.costumeId = Math.floor(score / 1) % 10; //個位\n}\n\nforever(gameloop);\non('keydown', 'space', press);\n\n","created_at":"2022-07-20T15:32:25.455+08:00","updated_at":"2022-11-21T16:19:42.215+08:00","name":"節奏之王 (陣列精簡版)","language":"javascript","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/407681/2382d72121cc1beb28204e0d58b3f3a5.jpg"},"parent_id":323181,"plugin":"Game.set({ width: 1200, height: 900 });","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":130,"hashid":"2pdsrr2wm","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":9133571,"file_name":"k_0.png","project_id":407681,"asset_id":446099,"created_at":"2022-07-20T15:32:25.462+08:00","updated_at":"2022-07-20T15:32:25.462+08:00"},{"id":9133572,"file_name":"5.png","project_id":407681,"asset_id":446100,"created_at":"2022-07-20T15:32:25.463+08:00","updated_at":"2022-07-20T15:32:25.463+08:00"},{"id":9133573,"file_name":"9.png","project_id":407681,"asset_id":446103,"created_at":"2022-07-20T15:32:25.464+08:00","updated_at":"2022-07-20T15:32:25.464+08:00"},{"id":9133574,"file_name":"6.png","project_id":407681,"asset_id":446104,"created_at":"2022-07-20T15:32:25.465+08:00","updated_at":"2022-07-20T15:32:25.465+08:00"},{"id":9133575,"file_name":"result_0.png","project_id":407681,"asset_id":446097,"created_at":"2022-07-20T15:32:25.467+08:00","updated_at":"2022-07-20T15:32:25.467+08:00"},{"id":9133576,"file_name":"result_1.png","project_id":407681,"asset_id":446098,"created_at":"2022-07-20T15:32:25.468+08:00","updated_at":"2022-07-20T15:32:25.468+08:00"},{"id":9133577,"file_name":"bgm.mp3","project_id":407681,"asset_id":438072,"created_at":"2022-07-20T15:32:25.469+08:00","updated_at":"2022-07-20T15:32:25.469+08:00"},{"id":9133578,"file_name":"3.png","project_id":407681,"asset_id":446109,"created_at":"2022-07-20T15:32:25.471+08:00","updated_at":"2022-07-20T15:32:25.471+08:00"},{"id":9133579,"file_name":"8.png","project_id":407681,"asset_id":446091,"created_at":"2022-07-20T15:32:25.472+08:00","updated_at":"2022-07-20T15:32:25.472+08:00"},{"id":9133580,"file_name":"7.png","project_id":407681,"asset_id":446092,"created_at":"2022-07-20T15:32:25.472+08:00","updated_at":"2022-07-20T15:32:25.472+08:00"},{"id":9133581,"file_name":"1.png","project_id":407681,"asset_id":446105,"created_at":"2022-07-20T15:32:25.473+08:00","updated_at":"2022-07-20T15:32:25.473+08:00"},{"id":9133582,"file_name":"2.png","project_id":407681,"asset_id":446106,"created_at":"2022-07-20T15:32:25.475+08:00","updated_at":"2022-07-20T15:32:25.475+08:00"},{"id":9133583,"file_name":"k_4.png","project_id":407681,"asset_id":446093,"created_at":"2022-07-20T15:32:25.476+08:00","updated_at":"2022-07-20T15:32:25.476+08:00"},{"id":9133584,"file_name":"result_2.png","project_id":407681,"asset_id":446094,"created_at":"2022-07-20T15:32:25.477+08:00","updated_at":"2022-07-20T15:32:25.477+08:00"},{"id":9133585,"file_name":"drum.wav","project_id":407681,"asset_id":437605,"created_at":"2022-07-20T15:32:25.478+08:00","updated_at":"2022-07-20T15:32:25.478+08:00"},{"id":9133586,"file_name":"bg.png","project_id":407681,"asset_id":446095,"created_at":"2022-07-20T15:32:25.480+08:00","updated_at":"2022-07-20T15:32:25.480+08:00"},{"id":9133587,"file_name":"k_2.png","project_id":407681,"asset_id":446096,"created_at":"2022-07-20T15:32:25.481+08:00","updated_at":"2022-07-20T15:32:25.481+08:00"},{"id":9133588,"file_name":"4.png","project_id":407681,"asset_id":446107,"created_at":"2022-07-20T15:32:25.483+08:00","updated_at":"2022-07-20T15:32:25.483+08:00"},{"id":9133589,"file_name":"k_1.png","project_id":407681,"asset_id":446108,"created_at":"2022-07-20T15:32:25.484+08:00","updated_at":"2022-07-20T15:32:25.484+08:00"},{"id":9133590,"file_name":"k_6.png","project_id":407681,"asset_id":446089,"created_at":"2022-07-20T15:32:25.485+08:00","updated_at":"2022-07-20T15:32:25.485+08:00"},{"id":9133591,"file_name":"k_3.png","project_id":407681,"asset_id":446090,"created_at":"2022-07-20T15:32:25.486+08:00","updated_at":"2022-07-20T15:32:25.486+08:00"},{"id":9133592,"file_name":"k_5.png","project_id":407681,"asset_id":446101,"created_at":"2022-07-20T15:32:25.487+08:00","updated_at":"2022-07-20T15:32:25.487+08:00"},{"id":9133593,"file_name":"0.png","project_id":407681,"asset_id":446102,"created_at":"2022-07-20T15:32:25.489+08:00","updated_at":"2022-07-20T15:32:25.489+08:00"},{"id":9133594,"file_name":"triangle.mp3","project_id":407681,"asset_id":463374,"created_at":"2022-07-20T15:32:25.490+08:00","updated_at":"2022-07-20T15:32:25.490+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦