{"id":366854,"student_id":2589,"content":"from game import *\nfrom random import randrange\n\n\nset_backdrop('bg.jpg') #設定背景圖\ntarget = create_sprite('target.png') #目標物\nboard1 = create_sprite('dashboard.png') #左上計分板\nboard2 = create_sprite('dashboard.png') #左下計分板\n\ntarget.move_to(0, 900)\nboard1.move_to(150, 50)\nboard2.move_to(150, 850)\n\nvx = 15 #目標物水平速度\nvy = -15 #目標物垂直速度\nscore = 0 #玩家得分\ncount = 0 #回合次數\nsigns = [] #存放準星的串列\n\nfor y in range(3):\n for x in range(3):\n s = create_sprite('sign_0.png', 'sign_1.png')\n s.x = 300 + x * 300\n s.y = 200 + y * 200\n signs.append(s)\n\n#遊戲主迴圈\ndef loop ():\n global vx, vy, score, count\n \n for s in signs: s.costume_id = 0\n \n if key.q: signs[0].costume_id = 1\n elif key.w: signs[1].costume_id = 1\n elif key.e: signs[2].costume_id = 1\n elif key.a: signs[3].costume_id = 1\n elif key.s: signs[4].costume_id = 1\n elif key.d: signs[5].costume_id = 1\n elif key.z: signs[6].costume_id = 1\n elif key.x: signs[7].costume_id = 1\n elif key.c: signs[8].costume_id = 1\n \n target.x += vx\n target.y += vy\n vy += 0.2\n target.scale -= 0.005\n \n if target.y \u003e 1000:\n target.x = randrange(-100, 1300)\n target.y = 1000\n target.scale = 1\n target.opacity = 1\n vy = -randrange(15, 20)\n vx = randrange(4, 8)\n if target.x \u003e 600: vx = -vx\n count += 1\n \n for s in signs:\n if s.costume_id == 1 and target.touched(s) and target.opacity == 1:\n target.opacity = 0.3\n score += 1\n \n if count == 30: stop()\n \n draw_text('回合: ' + str(count) + '/30', 30, 30, 'white', 50)\n draw_text('得分: ' + str(score), 30, 830, 'white', 50)\n\nforever(loop) #重複不斷執行遊戲迴圈\n\n","created_at":"2022-04-15T13:26:03.661+08:00","updated_at":"2022-06-18T11:45:32.317+08:00","name":"運動會系列 - 射擊競賽(完整版)","language":"python","screenshot":{"url":null},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[16827],"is_featured":false,"views":72,"hashid":"rdvs69r93","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":8095633,"file_name":"dashboard.png","project_id":366854,"asset_id":494690,"created_at":"2022-04-15T13:26:12.545+08:00","updated_at":"2022-04-15T13:26:12.545+08:00"},{"id":8095634,"file_name":"bg.jpg","project_id":366854,"asset_id":494691,"created_at":"2022-04-15T13:26:12.555+08:00","updated_at":"2022-04-15T13:26:12.555+08:00"},{"id":8095635,"file_name":"sign_1.png","project_id":366854,"asset_id":494692,"created_at":"2022-04-15T13:26:12.563+08:00","updated_at":"2022-04-15T13:26:12.563+08:00"},{"id":8095636,"file_name":"sign_0.png","project_id":366854,"asset_id":494693,"created_at":"2022-04-15T13:26:12.571+08:00","updated_at":"2022-04-15T13:26:12.571+08:00"},{"id":8095637,"file_name":"target.png","project_id":366854,"asset_id":494694,"created_at":"2022-04-15T13:26:12.576+08:00","updated_at":"2022-04-15T13:26:12.576+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦