{"id":208934,"student_id":10,"content":"import game","created_at":"2020-12-05T09:20:13.131+08:00","updated_at":"2023-03-12T10:07:14.651+08:00","name":"牛仔大對決(試玩版) ","language":"python","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/208934/a259d260bc0f9d201b9e933b567900f3.jpg"},"parent_id":196931,"plugin":"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是否已經開槍\n# 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\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 = math.floor(random.random()*400 + 100)\n p1.hidden = False\n p2.hidden = False\n info.hidden = True\n bgm.mute(False)\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\nforever(loop) #不斷執行遊戲迴圈","description":null,"note":null,"status":"public","like_student_ids":[11728,11892,7403,33576,29517,10891,9254,12833,12045,15248,35397,12466,16968,17411,22033,16670,23147,23460,28328,26482,28311,29570,34617,33563,35494,36066,26704,38763,54059,37772,35870,43026,51823,35917,27948,32561,42279,46637,46547,41701,19005,48427,50507,45894,43021],"is_featured":false,"views":2110,"hashid":"2pds9948v","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3641711,"file_name":"bg_0.png","project_id":208934,"asset_id":270889,"created_at":"2020-12-05T09:20:13.139+08:00","updated_at":"2020-12-05T09:20:13.139+08:00"},{"id":3641712,"file_name":"bg_1.png","project_id":208934,"asset_id":270888,"created_at":"2020-12-05T09:20:13.141+08:00","updated_at":"2020-12-05T09:20:13.141+08:00"},{"id":3641713,"file_name":"bgm.mp3","project_id":208934,"asset_id":270887,"created_at":"2020-12-05T09:20:13.142+08:00","updated_at":"2020-12-05T09:20:13.142+08:00"},{"id":3641714,"file_name":"cloud_1.png","project_id":208934,"asset_id":270886,"created_at":"2020-12-05T09:20:13.143+08:00","updated_at":"2020-12-05T09:20:13.143+08:00"},{"id":3641715,"file_name":"cloud_2.png","project_id":208934,"asset_id":270885,"created_at":"2020-12-05T09:20:13.144+08:00","updated_at":"2020-12-05T09:20:13.144+08:00"},{"id":3641716,"file_name":"cloud_3.png","project_id":208934,"asset_id":270884,"created_at":"2020-12-05T09:20:13.145+08:00","updated_at":"2020-12-05T09:20:13.145+08:00"},{"id":3641717,"file_name":"info.png","project_id":208934,"asset_id":270883,"created_at":"2020-12-05T09:20:13.146+08:00","updated_at":"2020-12-05T09:20:13.146+08:00"},{"id":3641718,"file_name":"p1_0.png","project_id":208934,"asset_id":270882,"created_at":"2020-12-05T09:20:13.147+08:00","updated_at":"2020-12-05T09:20:13.147+08:00"},{"id":3641719,"file_name":"p1_1.png","project_id":208934,"asset_id":270881,"created_at":"2020-12-05T09:20:13.148+08:00","updated_at":"2020-12-05T09:20:13.148+08:00"},{"id":3641720,"file_name":"p1_2.png","project_id":208934,"asset_id":270880,"created_at":"2020-12-05T09:20:13.149+08:00","updated_at":"2020-12-05T09:20:13.149+08:00"},{"id":3641721,"file_name":"p1_3.png","project_id":208934,"asset_id":270879,"created_at":"2020-12-05T09:20:13.150+08:00","updated_at":"2020-12-05T09:20:13.150+08:00"},{"id":3641722,"file_name":"p2_0.png","project_id":208934,"asset_id":270878,"created_at":"2020-12-05T09:20:13.151+08:00","updated_at":"2020-12-05T09:20:13.151+08:00"},{"id":3641723,"file_name":"p2_1.png","project_id":208934,"asset_id":270877,"created_at":"2020-12-05T09:20:13.152+08:00","updated_at":"2020-12-05T09:20:13.152+08:00"},{"id":3641724,"file_name":"p2_2.png","project_id":208934,"asset_id":270876,"created_at":"2020-12-05T09:20:13.153+08:00","updated_at":"2020-12-05T09:20:13.153+08:00"},{"id":3641725,"file_name":"p2_3.png","project_id":208934,"asset_id":270875,"created_at":"2020-12-05T09:20:13.154+08:00","updated_at":"2020-12-05T09:20:13.154+08:00"},{"id":3641726,"file_name":"shot.wav","project_id":208934,"asset_id":270874,"created_at":"2020-12-05T09:20:13.155+08:00","updated_at":"2020-12-05T09:20:13.155+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦