{"id":196931,"student_id":2589,"content":"","created_at":"2020-10-19T17:00:04.168+08:00","updated_at":"2020-10-19T17:00:35.086+08:00","name":"牛仔大對決(試玩版)","language":"python","screenshot":{"url":null},"parent_id":4,"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是否已經開槍\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.costumeId == 0:\n p1.costumeId = 1\n p2.costumeId = 1\n bgm.mute(True)\n \n if key.space and p2.costumeId == 1 and not p1_fired:\n p1.costumeId = 2\n p2.costumeId = 3\n sound.play('shot.wav')\n\n \n if key.enter and p2.costumeId == 1 and not p2_fired:\n p2.costumeId = 2\n p1.costumeId = 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.costumeId = 0\n p2.costumeId = 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":[],"is_featured":false,"views":116,"hashid":"meysw4gz8","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3377971,"file_name":"shot.wav","project_id":196931,"asset_id":270874,"created_at":"2020-10-19T17:00:19.935+08:00","updated_at":"2020-10-19T17:00:19.935+08:00"},{"id":3377972,"file_name":"p2_3.png","project_id":196931,"asset_id":270875,"created_at":"2020-10-19T17:00:19.940+08:00","updated_at":"2020-10-19T17:00:19.940+08:00"},{"id":3377973,"file_name":"p2_2.png","project_id":196931,"asset_id":270876,"created_at":"2020-10-19T17:00:19.944+08:00","updated_at":"2020-10-19T17:00:19.944+08:00"},{"id":3377974,"file_name":"p2_1.png","project_id":196931,"asset_id":270877,"created_at":"2020-10-19T17:00:19.948+08:00","updated_at":"2020-10-19T17:00:19.948+08:00"},{"id":3377975,"file_name":"p2_0.png","project_id":196931,"asset_id":270878,"created_at":"2020-10-19T17:00:19.952+08:00","updated_at":"2020-10-19T17:00:19.952+08:00"},{"id":3377976,"file_name":"p1_3.png","project_id":196931,"asset_id":270879,"created_at":"2020-10-19T17:00:19.956+08:00","updated_at":"2020-10-19T17:00:19.956+08:00"},{"id":3377977,"file_name":"p1_2.png","project_id":196931,"asset_id":270880,"created_at":"2020-10-19T17:00:19.960+08:00","updated_at":"2020-10-19T17:00:19.960+08:00"},{"id":3377978,"file_name":"p1_1.png","project_id":196931,"asset_id":270881,"created_at":"2020-10-19T17:00:19.964+08:00","updated_at":"2020-10-19T17:00:19.964+08:00"},{"id":3377979,"file_name":"p1_0.png","project_id":196931,"asset_id":270882,"created_at":"2020-10-19T17:00:19.968+08:00","updated_at":"2020-10-19T17:00:19.968+08:00"},{"id":3377980,"file_name":"info.png","project_id":196931,"asset_id":270883,"created_at":"2020-10-19T17:00:19.973+08:00","updated_at":"2020-10-19T17:00:19.973+08:00"},{"id":3377981,"file_name":"cloud_3.png","project_id":196931,"asset_id":270884,"created_at":"2020-10-19T17:00:19.978+08:00","updated_at":"2020-10-19T17:00:19.978+08:00"},{"id":3377982,"file_name":"cloud_2.png","project_id":196931,"asset_id":270885,"created_at":"2020-10-19T17:00:19.982+08:00","updated_at":"2020-10-19T17:00:19.982+08:00"},{"id":3377983,"file_name":"cloud_1.png","project_id":196931,"asset_id":270886,"created_at":"2020-10-19T17:00:19.986+08:00","updated_at":"2020-10-19T17:00:19.986+08:00"},{"id":3377984,"file_name":"bgm.mp3","project_id":196931,"asset_id":270887,"created_at":"2020-10-19T17:00:20.355+08:00","updated_at":"2020-10-19T17:00:20.355+08:00"},{"id":3377985,"file_name":"bg_1.png","project_id":196931,"asset_id":270888,"created_at":"2020-10-19T17:00:20.362+08:00","updated_at":"2020-10-19T17:00:20.362+08:00"},{"id":3377986,"file_name":"bg_0.png","project_id":196931,"asset_id":270889,"created_at":"2020-10-19T17:00:20.366+08:00","updated_at":"2020-10-19T17:00:20.366+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦