{"id":169401,"student_id":10,"content":"import game #載入遊戲套件\nimport random #載入產生隨機數的套件\n\ngame.create_sprite('bg_0.png') #背景圖1\ngame.create_sprite('bg_1.png') #背景圖2\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')\n\np1.move_to(600, 700)\np2.move_to(600, 700)\n\nsteps = random.randint(100, 500)\np1_fired = False\np2_fired = False\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 #按下space鍵 而且 是轉身造型 而且 p1尚未按過按鍵\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 #按下enter鍵 而且 是轉身造型 而且 p2尚未按過按鍵\n if game.key.enter == True and p2.costume_id == 1 and p2_fired == False:\n p1.costume_id = 3 #死亡\n p2.costume_id = 2 #開槍\n \n if game.key.space == True:\n p1_fired = True\n \n if game.key.enter == True:\n p2_fired = True\n\n\ngame.forever(loop) #不斷執行遊戲迴圈\n\n\n\n\n","created_at":"2020-07-22T13:55:32.058+08:00","updated_at":"2020-07-22T17:06:35.364+08:00","name":"牛仔大對決(錄音版)","language":"python","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/169401/a711fac2736e0b1177b76f4736f93efd.jpg"},"parent_id":150156,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":243,"hashid":"2pdsk3r6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2927680,"file_name":"shot.wav","project_id":169401,"asset_id":17859,"created_at":"2020-07-22T13:55:32.064+08:00","updated_at":"2020-07-22T13:55:32.064+08:00"},{"id":2927681,"file_name":"p2_3.png","project_id":169401,"asset_id":192678,"created_at":"2020-07-22T13:55:32.065+08:00","updated_at":"2020-07-22T13:55:32.065+08:00"},{"id":2927682,"file_name":"p2_2.png","project_id":169401,"asset_id":192677,"created_at":"2020-07-22T13:55:32.066+08:00","updated_at":"2020-07-22T13:55:32.066+08:00"},{"id":2927683,"file_name":"p2_1.png","project_id":169401,"asset_id":192676,"created_at":"2020-07-22T13:55:32.067+08:00","updated_at":"2020-07-22T13:55:32.067+08:00"},{"id":2927684,"file_name":"p2_0.png","project_id":169401,"asset_id":192675,"created_at":"2020-07-22T13:55:32.068+08:00","updated_at":"2020-07-22T13:55:32.068+08:00"},{"id":2927685,"file_name":"p1_3.png","project_id":169401,"asset_id":192674,"created_at":"2020-07-22T13:55:32.069+08:00","updated_at":"2020-07-22T13:55:32.069+08:00"},{"id":2927686,"file_name":"p1_2.png","project_id":169401,"asset_id":192673,"created_at":"2020-07-22T13:55:32.070+08:00","updated_at":"2020-07-22T13:55:32.070+08:00"},{"id":2927687,"file_name":"p1_1.png","project_id":169401,"asset_id":192672,"created_at":"2020-07-22T13:55:32.071+08:00","updated_at":"2020-07-22T13:55:32.071+08:00"},{"id":2927688,"file_name":"p1_0.png","project_id":169401,"asset_id":192671,"created_at":"2020-07-22T13:55:32.072+08:00","updated_at":"2020-07-22T13:55:32.072+08:00"},{"id":2927689,"file_name":"info.png","project_id":169401,"asset_id":192685,"created_at":"2020-07-22T13:55:32.072+08:00","updated_at":"2020-07-22T13:55:32.072+08:00"},{"id":2927690,"file_name":"cloud_3.png","project_id":169401,"asset_id":192578,"created_at":"2020-07-22T13:55:32.073+08:00","updated_at":"2020-07-22T13:55:32.073+08:00"},{"id":2927691,"file_name":"cloud_2.png","project_id":169401,"asset_id":192577,"created_at":"2020-07-22T13:55:32.074+08:00","updated_at":"2020-07-22T13:55:32.074+08:00"},{"id":2927692,"file_name":"cloud_1.png","project_id":169401,"asset_id":192679,"created_at":"2020-07-22T13:55:32.075+08:00","updated_at":"2020-07-22T13:55:32.075+08:00"},{"id":2927693,"file_name":"bgm.mp3","project_id":169401,"asset_id":172549,"created_at":"2020-07-22T13:55:32.076+08:00","updated_at":"2020-07-22T13:55:32.076+08:00"},{"id":2927694,"file_name":"bg_1.png","project_id":169401,"asset_id":192574,"created_at":"2020-07-22T13:55:32.077+08:00","updated_at":"2020-07-22T13:55:32.077+08:00"},{"id":2927695,"file_name":"bg_0.png","project_id":169401,"asset_id":192575,"created_at":"2020-07-22T13:55:32.078+08:00","updated_at":"2020-07-22T13:55:32.078+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦