{"id":150156,"student_id":10,"content":"import math #載入數學工具套件\nimport random #載入產生隨機數的套件\n\ncreateSprite('bg_0.png') #背景圖1\nc1 = createSprite('cloud_1.png') #雲朵1\nc2 = createSprite('cloud_2.png') #雲朵2\nc3 = createSprite('cloud_3.png') #雲朵3\ncreateSprite('bg_1.png') #背景圖2\np1 = createSprite('p1_0.png', 'p1_1.png', 'p1_2.png', 'p1_3.png') #左邊牛仔\np2 = createSprite('p2_0.png', 'p2_1.png', 'p2_2.png', 'p2_3.png') #右邊牛仔\ninfo = createSprite('info.png') #遊戲說明\n\nsteps = -1\np1_fired = False #p1是否已經開槍\np2_fired = False #p2是否已經開槍\nbgm = 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\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 bgm.mute(True)\n \n if key.space and p2.costume_id == 1 and not p1_fired:\n p1.costume_id = 2\n p2.costume_id = 3\n sound.play('shot.wav')\n\n \n if key.enter and p2.costume_id == 1 and not p2_fired:\n p2.costume_id = 2\n p1.costume_id = 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.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 bgm.mute(False)\n\n\nforever(loop) #不斷執行遊戲迴圈","created_at":"2020-05-21T11:23:06.546+08:00","updated_at":"2021-10-22T16:16:31.315+08:00","name":"牛仔大對決(完整版)","language":"python","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/150156/d0a81ce81195fd74f12f722f13ecb19c.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":256,"hashid":"4y3sm36r","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6238604,"file_name":"shot.wav","project_id":150156,"asset_id":428134,"created_at":"2021-10-22T15:58:24.208+08:00","updated_at":"2021-10-22T15:58:24.208+08:00"},{"id":6238605,"file_name":"p2_3.png","project_id":150156,"asset_id":428135,"created_at":"2021-10-22T15:58:24.212+08:00","updated_at":"2021-10-22T15:58:24.212+08:00"},{"id":6238606,"file_name":"p2_2.png","project_id":150156,"asset_id":428136,"created_at":"2021-10-22T15:58:24.217+08:00","updated_at":"2021-10-22T15:58:24.217+08:00"},{"id":6238607,"file_name":"p2_1.png","project_id":150156,"asset_id":428137,"created_at":"2021-10-22T15:58:24.221+08:00","updated_at":"2021-10-22T15:58:24.221+08:00"},{"id":6238608,"file_name":"p2_0.png","project_id":150156,"asset_id":428138,"created_at":"2021-10-22T15:58:24.226+08:00","updated_at":"2021-10-22T15:58:24.226+08:00"},{"id":6238609,"file_name":"p1_3.png","project_id":150156,"asset_id":428139,"created_at":"2021-10-22T15:58:24.231+08:00","updated_at":"2021-10-22T15:58:24.231+08:00"},{"id":6238610,"file_name":"p1_2.png","project_id":150156,"asset_id":428140,"created_at":"2021-10-22T15:58:24.235+08:00","updated_at":"2021-10-22T15:58:24.235+08:00"},{"id":6238611,"file_name":"p1_1.png","project_id":150156,"asset_id":428141,"created_at":"2021-10-22T15:58:24.240+08:00","updated_at":"2021-10-22T15:58:24.240+08:00"},{"id":6238612,"file_name":"p1_0.png","project_id":150156,"asset_id":428142,"created_at":"2021-10-22T15:58:24.244+08:00","updated_at":"2021-10-22T15:58:24.244+08:00"},{"id":6238613,"file_name":"info.png","project_id":150156,"asset_id":428143,"created_at":"2021-10-22T15:58:24.250+08:00","updated_at":"2021-10-22T15:58:24.250+08:00"},{"id":6238614,"file_name":"cloud_3.png","project_id":150156,"asset_id":428144,"created_at":"2021-10-22T15:58:24.254+08:00","updated_at":"2021-10-22T15:58:24.254+08:00"},{"id":6238615,"file_name":"cloud_2.png","project_id":150156,"asset_id":428145,"created_at":"2021-10-22T15:58:24.258+08:00","updated_at":"2021-10-22T15:58:24.258+08:00"},{"id":6238616,"file_name":"cloud_1.png","project_id":150156,"asset_id":428146,"created_at":"2021-10-22T15:58:24.262+08:00","updated_at":"2021-10-22T15:58:24.262+08:00"},{"id":6238617,"file_name":"bgm.mp3","project_id":150156,"asset_id":428147,"created_at":"2021-10-22T15:58:24.345+08:00","updated_at":"2021-10-22T15:58:24.345+08:00"},{"id":6238618,"file_name":"bg_1.png","project_id":150156,"asset_id":428148,"created_at":"2021-10-22T15:58:24.351+08:00","updated_at":"2021-10-22T15:58:24.351+08:00"},{"id":6238619,"file_name":"bg_0.png","project_id":150156,"asset_id":428149,"created_at":"2021-10-22T15:58:24.355+08:00","updated_at":"2021-10-22T15:58:24.355+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦