{"id":183188,"student_id":2589,"content":"","created_at":"2020-08-20T11:16:33.227+08:00","updated_at":"2020-08-20T11:17:02.906+08:00","name":"牛仔大對決(完整版)","language":"javascript","screenshot":{"url":null},"parent_id":2,"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 if (steps \u003e 0) {\n steps -= 1;\n p1.x -= 1;\n p2.x += 1;\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 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 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 if (key.enter) {\n p2_fired = true;\n }\n if (key.space) {\n p1_fired = true;\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":85,"hashid":"d5ms5e2q","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3115487,"file_name":"info.png","project_id":183188,"asset_id":251262,"created_at":"2020-08-20T11:16:48.252+08:00","updated_at":"2020-08-20T11:16:48.252+08:00"},{"id":3115488,"file_name":"cloud_1.png","project_id":183188,"asset_id":251263,"created_at":"2020-08-20T11:16:48.257+08:00","updated_at":"2020-08-20T11:16:48.257+08:00"},{"id":3115489,"file_name":"p2_3.png","project_id":183188,"asset_id":251264,"created_at":"2020-08-20T11:16:48.261+08:00","updated_at":"2020-08-20T11:16:48.261+08:00"},{"id":3115490,"file_name":"p2_2.png","project_id":183188,"asset_id":251265,"created_at":"2020-08-20T11:16:48.265+08:00","updated_at":"2020-08-20T11:16:48.265+08:00"},{"id":3115491,"file_name":"p2_1.png","project_id":183188,"asset_id":251266,"created_at":"2020-08-20T11:16:48.268+08:00","updated_at":"2020-08-20T11:16:48.268+08:00"},{"id":3115492,"file_name":"p2_0.png","project_id":183188,"asset_id":251267,"created_at":"2020-08-20T11:16:48.273+08:00","updated_at":"2020-08-20T11:16:48.273+08:00"},{"id":3115493,"file_name":"p1_3.png","project_id":183188,"asset_id":251268,"created_at":"2020-08-20T11:16:48.277+08:00","updated_at":"2020-08-20T11:16:48.277+08:00"},{"id":3115494,"file_name":"p1_2.png","project_id":183188,"asset_id":251269,"created_at":"2020-08-20T11:16:48.281+08:00","updated_at":"2020-08-20T11:16:48.281+08:00"},{"id":3115495,"file_name":"p1_1.png","project_id":183188,"asset_id":251270,"created_at":"2020-08-20T11:16:48.285+08:00","updated_at":"2020-08-20T11:16:48.285+08:00"},{"id":3115496,"file_name":"p1_0.png","project_id":183188,"asset_id":251271,"created_at":"2020-08-20T11:16:48.290+08:00","updated_at":"2020-08-20T11:16:48.290+08:00"},{"id":3115497,"file_name":"cloud_3.png","project_id":183188,"asset_id":251272,"created_at":"2020-08-20T11:16:48.295+08:00","updated_at":"2020-08-20T11:16:48.295+08:00"},{"id":3115498,"file_name":"cloud_2.png","project_id":183188,"asset_id":251273,"created_at":"2020-08-20T11:16:48.299+08:00","updated_at":"2020-08-20T11:16:48.299+08:00"},{"id":3115499,"file_name":"bg_0.png","project_id":183188,"asset_id":251274,"created_at":"2020-08-20T11:16:48.304+08:00","updated_at":"2020-08-20T11:16:48.304+08:00"},{"id":3115500,"file_name":"bg_1.png","project_id":183188,"asset_id":251275,"created_at":"2020-08-20T11:16:48.309+08:00","updated_at":"2020-08-20T11:16:48.309+08:00"},{"id":3115501,"file_name":"bgm.mp3","project_id":183188,"asset_id":251276,"created_at":"2020-08-20T11:16:48.417+08:00","updated_at":"2020-08-20T11:16:48.417+08:00"},{"id":3115502,"file_name":"shot.wav","project_id":183188,"asset_id":251277,"created_at":"2020-08-20T11:16:48.429+08:00","updated_at":"2020-08-20T11:16:48.429+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦