{"id":602035,"student_id":58026,"content":"import game #載入遊戲套件\nimport random #載入產生隨機數的套件\n\ngame.create_sprite('bg_0.png') #背景圖1\nc1 = game.create_sprite(\"cloud_1.png\")\nc2 = game.create_sprite(\"cloud_2.png\")\nc3 = game.create_sprite(\"cloud_3.png\")\ngame.create_sprite('bg_1.png') #背景圖2\n\np1 = game.create_sprite('p1_0.png', 'p1_1.png', 'p1_2.png', 'p1_3.png')\np2 = game.create_sprite('p2_0.png', 'p2_1.png', 'p2_2.png', 'p2_3.png')\ninfo = game.create_sprite(\"info.png\") #創造角色\np1.move_to(600, 700)\np2.move_to(600, 700)\nc1.move_to(700, 300)\nc2.move_to(200, 150)\nc3.move_to(1150, 50)\n\nsteps = random.randint(100, 500)\n\np1_fired = False\np2_fired = False\np1.hidden = True\np2.hidden = True\n\n\n\n# 遊戲主迴圈\ndef loop ():\n global steps, p1_fired, p2_fired\n \n if steps \u003e 0:\n p1.x -= 1\n p2.x += 1\n steps -= 1\n \n if steps == 0 and p1.costume_id == 0:\n p1.costume_id = 1\n p2.costume_id = 1\n \n \n \n if game.key.space == True and p1.costume_id == 1 and p1_fired == False:\n p1.costume_id = 2\n p2.costume_id = 3\n \n \n if game.key.enter == True and p2.costume_id == 1 and p2_fired == False:\n p2.costume_id = 2\n p1.costume_id = 3\n \n \n \n if game.key.space == True:\n p1_fired = True\n \n if game.key.enter == True:\n p2_fired = True\n \n \n \n \n \n \n \n if game.key.r == True:\n p1.move_to(600, 700)\n p2.move_to(600, 700)\n p1.costume_id = 0\n p2.costume_id = 0\n p1_fired = False\n p2_fired = False\n steps = random.randint(100, 500)\n p1.hidden = False\n p2.hidden = False\n info.hidden = True\n \n \n c1.x -= 0.3\n c2.x -= 0.5\n c3.x -= 0.7\n \n if c1.x \u003c -200:\n cl.x += 1500\n if c2.x \u003c -200:\n c2.x += 1500\n if c3.x \u003c -200:\n c3.x += 1500\n \n \n \n \n \n \n\nforever(loop) #不斷執行遊戲迴圈","created_at":"2023-09-02T10:04:33.434+08:00","updated_at":"2024-08-18T20:54:44.877+08:00","name":"牛仔大對決(預設版) 副本","language":"python","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/602035/3ad0c0212fd8125eae87aedff77b7553.jpg"},"parent_id":183412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":6,"hashid":"d5msnywng","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":13568046,"file_name":"shot.wav","project_id":602035,"asset_id":251747,"created_at":"2023-09-02T10:04:33.440+08:00","updated_at":"2023-09-02T10:04:33.440+08:00"},{"id":13568047,"file_name":"p2_3.png","project_id":602035,"asset_id":251748,"created_at":"2023-09-02T10:04:33.441+08:00","updated_at":"2023-09-02T10:04:33.441+08:00"},{"id":13568048,"file_name":"p2_2.png","project_id":602035,"asset_id":251749,"created_at":"2023-09-02T10:04:33.443+08:00","updated_at":"2023-09-02T10:04:33.443+08:00"},{"id":13568049,"file_name":"p2_1.png","project_id":602035,"asset_id":251750,"created_at":"2023-09-02T10:04:33.444+08:00","updated_at":"2023-09-02T10:04:33.444+08:00"},{"id":13568050,"file_name":"p2_0.png","project_id":602035,"asset_id":251751,"created_at":"2023-09-02T10:04:33.445+08:00","updated_at":"2023-09-02T10:04:33.445+08:00"},{"id":13568051,"file_name":"p1_3.png","project_id":602035,"asset_id":251752,"created_at":"2023-09-02T10:04:33.446+08:00","updated_at":"2023-09-02T10:04:33.446+08:00"},{"id":13568052,"file_name":"p1_2.png","project_id":602035,"asset_id":251753,"created_at":"2023-09-02T10:04:33.447+08:00","updated_at":"2023-09-02T10:04:33.447+08:00"},{"id":13568053,"file_name":"p1_1.png","project_id":602035,"asset_id":251754,"created_at":"2023-09-02T10:04:33.448+08:00","updated_at":"2023-09-02T10:04:33.448+08:00"},{"id":13568054,"file_name":"p1_0.png","project_id":602035,"asset_id":251755,"created_at":"2023-09-02T10:04:33.449+08:00","updated_at":"2023-09-02T10:04:33.449+08:00"},{"id":13568055,"file_name":"info.png","project_id":602035,"asset_id":251756,"created_at":"2023-09-02T10:04:33.451+08:00","updated_at":"2023-09-02T10:04:33.451+08:00"},{"id":13568056,"file_name":"cloud_3.png","project_id":602035,"asset_id":251757,"created_at":"2023-09-02T10:04:33.451+08:00","updated_at":"2023-09-02T10:04:33.451+08:00"},{"id":13568057,"file_name":"cloud_2.png","project_id":602035,"asset_id":251758,"created_at":"2023-09-02T10:04:33.452+08:00","updated_at":"2023-09-02T10:04:33.452+08:00"},{"id":13568058,"file_name":"cloud_1.png","project_id":602035,"asset_id":251759,"created_at":"2023-09-02T10:04:33.453+08:00","updated_at":"2023-09-02T10:04:33.453+08:00"},{"id":13568059,"file_name":"bgm.mp3","project_id":602035,"asset_id":251760,"created_at":"2023-09-02T10:04:33.454+08:00","updated_at":"2023-09-02T10:04:33.454+08:00"},{"id":13568060,"file_name":"bg_1.png","project_id":602035,"asset_id":251761,"created_at":"2023-09-02T10:04:33.455+08:00","updated_at":"2023-09-02T10:04:33.455+08:00"},{"id":13568061,"file_name":"bg_0.png","project_id":602035,"asset_id":251762,"created_at":"2023-09-02T10:04:33.456+08:00","updated_at":"2023-09-02T10:04:33.456+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦