{"id":183228,"student_id":2589,"content":"","created_at":"2020-08-20T13:38:38.146+08:00","updated_at":"2020-08-20T13:39:23.556+08:00","name":"牛仔大對決(試玩版)","language":"javascript","screenshot":{"url":null},"parent_id":183222,"plugin":"Game.set({\n width: 1200,\n height: 900,\n})\n\ncreateSprite('bg_0.png'); //背景圖1\nvar c1 = createSprite('cloud_1.png');\nvar c2 = createSprite('cloud_2.png');\nvar c3 = createSprite('cloud_3.png');\ncreateSprite('bg_1.png'); //背景圖2\nvar p1 = createSprite('p1_0.png', 'p1_1.png', 'p1_2.png', 'p1_3.png'); //左邊牛仔\nvar p2 = createSprite('p2_0.png', 'p2_1.png', 'p2_2.png', 'p2_3.png'); //右邊牛仔\nvar info = createSprite('info.png'); //遊戲說明\n\nvar steps = -1; //移動的剩餘步數\nvar p1_fired = false; //p1是否已經開槍\nvar p2_fired = false; //p2是否已經開槍\nvar bgm = sound.play('bgm.mp3', true);\n\np1.moveTo(600, 700);\np2.moveTo(600, 700);\nc1.moveTo(700, 300);\nc2.moveTo(200, 150);\nc3.moveTo(1100, 50);\n\np1.hidden = true;\np2.hidden = true;\n\nforever(loop); //不斷執行遊戲迴圈\n\n// 遊戲主迴圈\nfunction loop () {\n \n if (steps \u003e 0) {\n steps -= 1;\n p1.x -= 1;\n p2.x += 1;\n }\n \n //如果剩餘步數為零 且 雙方還在走路造型\n if (steps == 0 \u0026\u0026 p1.costumeId == 0) {\n p1.costumeId = 1; //角色轉身\n p2.costumeId = 1; //角色轉身\n bgm.mute(true);\n }\n \n //按下空白鍵 且 角色已經轉身 且 p1 還沒開槍\n if (key.space \u0026\u0026 p2.costumeId == 1 \u0026\u0026 p1_fired == false) {\n p1.costumeId = 2;\n p2.costumeId = 3;\n sound.play('shot.wav');\n }\n \n //按下enter 且 角色已經轉身 且 p2 還沒開槍\n if (key.enter \u0026\u0026 p2.costumeId == 1 \u0026\u0026 p2_fired == false) {\n p2.costumeId = 2;\n p1.costumeId = 3;\n sound.play('shot.wav');\n }\n \n //紀錄雙方玩家是否按下按鍵\n if (key.enter) {\n p2_fired = true;\n }\n if (key.space) {\n p1_fired = true;\n }\n \n //重新開始\n if (key.r) {\n p1.moveTo(600, 700);\n p2.moveTo(600, 700);\n p1.costumeId = 0;\n p2.costumeId = 0;\n p1_fired = false;\n p2_fired = false;\n steps = Math.floor(Math.random()*400 + 100);\n p1.hidden = false;\n p2.hidden = false;\n info.hidden = true;\n bgm.mute(false);\n }\n\n c1.x -= 0.3;\n if (c1.x \u003c -200) {\n c1.x += 1500;\n }\n c2.x -= 0.5;\n if (c2.x \u003c -200) {\n c2.x += 1500;\n }\n c3.x -= 0.7;\n if (c3.x \u003c -200) {\n c3.x += 1500;\n }\n}","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":78,"hashid":"5j3sk2ej","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3116161,"file_name":"bg_1.png","project_id":183228,"asset_id":251375,"created_at":"2020-08-20T13:38:38.151+08:00","updated_at":"2020-08-20T13:38:38.151+08:00"},{"id":3116162,"file_name":"bg_0.png","project_id":183228,"asset_id":251376,"created_at":"2020-08-20T13:38:38.153+08:00","updated_at":"2020-08-20T13:38:38.153+08:00"},{"id":3116163,"file_name":"shot.wav","project_id":183228,"asset_id":172548,"created_at":"2020-08-20T13:38:38.153+08:00","updated_at":"2020-08-20T13:38:38.153+08:00"},{"id":3116164,"file_name":"bgm.mp3","project_id":183228,"asset_id":172549,"created_at":"2020-08-20T13:38:38.154+08:00","updated_at":"2020-08-20T13:38:38.154+08:00"},{"id":3116165,"file_name":"board.png","project_id":183228,"asset_id":251377,"created_at":"2020-08-20T13:38:38.155+08:00","updated_at":"2020-08-20T13:38:38.155+08:00"},{"id":3116166,"file_name":"cloud_1.png","project_id":183228,"asset_id":251378,"created_at":"2020-08-20T13:38:38.156+08:00","updated_at":"2020-08-20T13:38:38.156+08:00"},{"id":3116167,"file_name":"cloud_2.png","project_id":183228,"asset_id":251379,"created_at":"2020-08-20T13:38:38.157+08:00","updated_at":"2020-08-20T13:38:38.157+08:00"},{"id":3116168,"file_name":"cloud_3.png","project_id":183228,"asset_id":251380,"created_at":"2020-08-20T13:38:38.158+08:00","updated_at":"2020-08-20T13:38:38.158+08:00"},{"id":3116169,"file_name":"info.png","project_id":183228,"asset_id":251381,"created_at":"2020-08-20T13:38:38.159+08:00","updated_at":"2020-08-20T13:38:38.159+08:00"},{"id":3116170,"file_name":"p1_0.png","project_id":183228,"asset_id":251382,"created_at":"2020-08-20T13:38:38.160+08:00","updated_at":"2020-08-20T13:38:38.160+08:00"},{"id":3116171,"file_name":"p1_1.png","project_id":183228,"asset_id":251383,"created_at":"2020-08-20T13:38:38.160+08:00","updated_at":"2020-08-20T13:38:38.160+08:00"},{"id":3116172,"file_name":"p1_2.png","project_id":183228,"asset_id":251384,"created_at":"2020-08-20T13:38:38.161+08:00","updated_at":"2020-08-20T13:38:38.161+08:00"},{"id":3116173,"file_name":"p1_3.png","project_id":183228,"asset_id":251385,"created_at":"2020-08-20T13:38:38.162+08:00","updated_at":"2020-08-20T13:38:38.162+08:00"},{"id":3116174,"file_name":"p2_0.png","project_id":183228,"asset_id":251386,"created_at":"2020-08-20T13:38:38.163+08:00","updated_at":"2020-08-20T13:38:38.163+08:00"},{"id":3116175,"file_name":"p2_1.png","project_id":183228,"asset_id":251387,"created_at":"2020-08-20T13:38:38.164+08:00","updated_at":"2020-08-20T13:38:38.164+08:00"},{"id":3116176,"file_name":"p2_2.png","project_id":183228,"asset_id":251388,"created_at":"2020-08-20T13:38:38.165+08:00","updated_at":"2020-08-20T13:38:38.165+08:00"},{"id":3116177,"file_name":"p2_3.png","project_id":183228,"asset_id":251389,"created_at":"2020-08-20T13:38:38.166+08:00","updated_at":"2020-08-20T13:38:38.166+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦