{"id":22413,"student_id":1444,"content":"\n// 設定背景圖\nsetBackdrop('bg.png',0, 0, 640, 480);\n//創造角色物件\nvar p1 = createSprite([\"right_0.png\",\"right_1.png\",\"right_2.png\",\"right_3.png\"]);\nvar p2 = createSprite([\"left_0.png\",\"left_1.png\",\"left_2.png\",\"left_3.png\"]);\n\nvar p1_win = 0;\nvar p2_win = 0;\n\nvar step = 0;\n\ninit();\n\nforever(function() {\n move();\n \n fire();\n \n if(p1.costumeId == 2 || p2.costumeId == 2) {\n if(key.q) {\n init();\n }\n }\n\n print('p1_win : ' + p1_win, 10, 10, 'red', 30);\n print('p2_win : ' + p2_win, 500, 10, 'red', 30); \n print('step: ' + step, 260, 10, 'red', 30); \n\n});\n\nfunction init(){\n p1.x = 350;\n p1.y = 400;\n p1.costumeId = 0;\n \n p2.x = 310;\n p2.y = 400;\n p2.costumeId = 0;\n \n step = Math.round(Math.random()*200 + 50);\n}\n\nfunction move(){\n if(step \u003e 0) {\n step -= 1;\n p1.x += 1;\n p2.x -= 1;\n }\n \n if(step == 0 \u0026\u0026 p1.costumeId == 0) {\n p1.costumeId = 1;\n p2.costumeId = 1;\n }\n}\n\nfunction fire(){\n if(key.enter \u0026\u0026 p2.costumeId == 1) {\n p1.costumeId = 2;\n p2.costumeId = 3;\n p2_win +=1;\n sound.play('shot.wav');\n }\n \n if(key.space \u0026\u0026 p2.costumeId == 1) {\n p2.costumeId = 2;\n p1.costumeId = 3;\n p1_win +=1;\n sound.play('shot.wav');\n }\n}\n","created_at":"2018-02-21T15:45:14.553+08:00","updated_at":"2019-08-04T06:06:24.571+08:00","name":"牛仔大對決","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/22413/10544d4d46219a19faa860089fb9425b.jpg"},"parent_id":10701,"plugin":"","description":"","note":"","status":"public","like_student_ids":[],"is_featured":false,"views":104,"hashid":"yeysq29y","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":430769,"file_name":"bg.png","project_id":22413,"asset_id":28736,"created_at":"2018-02-21T15:45:14.561+08:00","updated_at":"2018-02-21T15:45:14.561+08:00"},{"id":430770,"file_name":"shot.wav","project_id":22413,"asset_id":28737,"created_at":"2018-02-21T15:45:14.564+08:00","updated_at":"2018-02-21T15:45:14.564+08:00"},{"id":430771,"file_name":"left_1.png","project_id":22413,"asset_id":28738,"created_at":"2018-02-21T15:45:14.567+08:00","updated_at":"2018-02-21T15:45:14.567+08:00"},{"id":430772,"file_name":"left_0.png","project_id":22413,"asset_id":28739,"created_at":"2018-02-21T15:45:14.568+08:00","updated_at":"2018-02-21T15:45:14.568+08:00"},{"id":430773,"file_name":"left_2.png","project_id":22413,"asset_id":28740,"created_at":"2018-02-21T15:45:14.571+08:00","updated_at":"2018-02-21T15:45:14.571+08:00"},{"id":430774,"file_name":"left_3.png","project_id":22413,"asset_id":28741,"created_at":"2018-02-21T15:45:14.572+08:00","updated_at":"2018-02-21T15:45:14.572+08:00"},{"id":430775,"file_name":"right_0.png","project_id":22413,"asset_id":28742,"created_at":"2018-02-21T15:45:14.574+08:00","updated_at":"2018-02-21T15:45:14.574+08:00"},{"id":430776,"file_name":"right_1.png","project_id":22413,"asset_id":28743,"created_at":"2018-02-21T15:45:14.576+08:00","updated_at":"2018-02-21T15:45:14.576+08:00"},{"id":430777,"file_name":"right_2.png","project_id":22413,"asset_id":28744,"created_at":"2018-02-21T15:45:14.577+08:00","updated_at":"2018-02-21T15:45:14.577+08:00"},{"id":430778,"file_name":"right_3.png","project_id":22413,"asset_id":28745,"created_at":"2018-02-21T15:45:14.580+08:00","updated_at":"2018-02-21T15:45:14.580+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦