{"id":286643,"student_id":10,"content":"import math #載入數學工具套件\nimport random #載入產生隨機數的套件\nimport game\n\ngame.create_sprite('bg_0.png') #背景圖1\nc1 = game.create_sprite('cloud_1.png') #雲朵1\nc2 = game.create_sprite('cloud_2.png') #雲朵2\nc3 = game.create_sprite('cloud_3.png') #雲朵3\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') #右邊牛仔\ninfo = game.create_sprite('info.png') #遊戲說明\n\nsteps = -1 #移動的剩餘步數\np1_fired = False #p1是否已經開槍\np2_fired = False #p2是否已經開槍\nbgm = game.create_sound('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\ngame.forever(loop) #不斷執行遊戲迴圈","created_at":"2021-08-12T23:24:02.525+08:00","updated_at":"2021-08-13T13:18:46.595+08:00","name":"牛仔大對決(試玩版) 副本","language":"python","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/286643/15afc9a929f60812972b60f3fcbcb78c.jpg"},"parent_id":208934,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":216,"hashid":"882sqm6zk","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":5669649,"file_name":"bg_0.png","project_id":286643,"asset_id":270889,"created_at":"2021-08-12T23:24:02.531+08:00","updated_at":"2021-08-12T23:24:02.531+08:00"},{"id":5669650,"file_name":"bg_1.png","project_id":286643,"asset_id":270888,"created_at":"2021-08-12T23:24:02.532+08:00","updated_at":"2021-08-12T23:24:02.532+08:00"},{"id":5669651,"file_name":"bgm.mp3","project_id":286643,"asset_id":270887,"created_at":"2021-08-12T23:24:02.533+08:00","updated_at":"2021-08-12T23:24:02.533+08:00"},{"id":5669652,"file_name":"cloud_1.png","project_id":286643,"asset_id":270886,"created_at":"2021-08-12T23:24:02.534+08:00","updated_at":"2021-08-12T23:24:02.534+08:00"},{"id":5669653,"file_name":"cloud_2.png","project_id":286643,"asset_id":270885,"created_at":"2021-08-12T23:24:02.535+08:00","updated_at":"2021-08-12T23:24:02.535+08:00"},{"id":5669654,"file_name":"cloud_3.png","project_id":286643,"asset_id":270884,"created_at":"2021-08-12T23:24:02.536+08:00","updated_at":"2021-08-12T23:24:02.536+08:00"},{"id":5669655,"file_name":"info.png","project_id":286643,"asset_id":270883,"created_at":"2021-08-12T23:24:02.536+08:00","updated_at":"2021-08-12T23:24:02.536+08:00"},{"id":5669656,"file_name":"p1_0.png","project_id":286643,"asset_id":270882,"created_at":"2021-08-12T23:24:02.537+08:00","updated_at":"2021-08-12T23:24:02.537+08:00"},{"id":5669657,"file_name":"p1_1.png","project_id":286643,"asset_id":270881,"created_at":"2021-08-12T23:24:02.538+08:00","updated_at":"2021-08-12T23:24:02.538+08:00"},{"id":5669658,"file_name":"p1_2.png","project_id":286643,"asset_id":270880,"created_at":"2021-08-12T23:24:02.539+08:00","updated_at":"2021-08-12T23:24:02.539+08:00"},{"id":5669659,"file_name":"p1_3.png","project_id":286643,"asset_id":270879,"created_at":"2021-08-12T23:24:02.540+08:00","updated_at":"2021-08-12T23:24:02.540+08:00"},{"id":5669660,"file_name":"p2_0.png","project_id":286643,"asset_id":270878,"created_at":"2021-08-12T23:24:02.540+08:00","updated_at":"2021-08-12T23:24:02.540+08:00"},{"id":5669661,"file_name":"p2_1.png","project_id":286643,"asset_id":270877,"created_at":"2021-08-12T23:24:02.541+08:00","updated_at":"2021-08-12T23:24:02.541+08:00"},{"id":5669662,"file_name":"p2_2.png","project_id":286643,"asset_id":270876,"created_at":"2021-08-12T23:24:02.542+08:00","updated_at":"2021-08-12T23:24:02.542+08:00"},{"id":5669663,"file_name":"p2_3.png","project_id":286643,"asset_id":270875,"created_at":"2021-08-12T23:24:02.543+08:00","updated_at":"2021-08-12T23:24:02.543+08:00"},{"id":5669664,"file_name":"shot.wav","project_id":286643,"asset_id":270874,"created_at":"2021-08-12T23:24:02.544+08:00","updated_at":"2021-08-12T23:24:02.544+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦