{"id":193851,"student_id":10,"content":"import game #載入遊戲套件\nimport random #載入隨機數套件\n\ngame.set_backdrop('bg.jpg') #設定背景圖\nswing = game.create_sprite('swing_0.png', 'swing_1.png') #盪鞦韆與叩叮\napple = game.create_sprite('apple.png') #蘋果\narcher = game.create_sprite('archer.png') #弓箭手\nbow = game.create_sprite('bow.png') #弓\narrow = game.create_sprite('arrow_0.png', 'arrow_1.png') #箭\nlife = game.create_sprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png')\n\nlife.x = 200\nlife.y = 75\nlife.costume_id = 5\n\nswing.x = 900\napple.x = 900\nswing.y = 400\napple.y = 400\n\narcher.x = 300\narcher.y = 600\nbow.x = 300\nbow.y = 600\narrow.x = 300\narrow.y = 600\n\nbow.direction = 135\narrow.direction = 135\n\nactive = False #紀錄是否按下過滑鼠\nscore = 0 #玩家得分\nvy = 0\n\n#遊戲主迴圈\ndef loop ():\n global active, score, vy\n \n #按住滑鼠拉動弓箭\n if game.cursor.is_down == True and bow.direction \u003e 30 and arrow.x == 300:\n bow.direction -= 2\n arrow.direction -= 2\n active = True\n \n #放開滑鼠且已經拉過弓箭\n if game.cursor.is_down == False and active == True:\n arrow.step_forward(25)\n arrow.direction += 1\n \n #如果箭碰到蘋果\n if arrow.touched(apple):\n apple.hidden = True\n arrow.costume_id = 1\n score += 1\n \n #如果超出場景下方或右邊邊界\n if arrow.x \u003e 1200 or arrow.y \u003e 900:\n arrow.x = 300\n arrow.y = 600\n active = False\n bow.direction = 135\n arrow.direction = 135\n apple.hidden = False\n \n #如果有射到蘋果就切換目標高度\n if arrow.costume_id == 1:\n rand = random.randrange(200, 700)\n apple.y = rand\n swing.y = rand\n if score \u003e= 10: vy = random.randrange(-5, 6)\n \n else:\n life.costume_id -= 1\n \n arrow.costume_id = 0\n \n #如果剩餘箭數用盡時\n if life.costume_id == 0:\n game.create_sprite('gameover.png')\n game.stop()\n\n game.draw_text(score, 1080, 50, 'white', 60)\n \n #如果箭碰到盪鞦韆叩叮\n if arrow.touched(swing):\n swing.costume_id = 1 #切換驚嚇表情\n else:\n swing.costume_id = 0 #否則切回一般表情\n \n if apple.y \u003c 200 or apple.y \u003e 700: vy = -vy\n apple.y += vy\n swing.y += vy\n\ngame.forever(loop) #重複不斷執行\n\n\n","created_at":"2020-09-24T17:56:50.506+08:00","updated_at":"2021-07-28T01:29:50.535+08:00","name":"射箭遊戲(錄影版)","language":"python","screenshot":{"url":"/uploads/project/screenshot/193851/70fc910a6dcb5a22a26ca4964dffa0e8.jpg"},"parent_id":3,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":422,"hashid":"qmdsznpk","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3317162,"file_name":"gameover.png","project_id":193851,"asset_id":266315,"created_at":"2020-09-24T17:57:03.722+08:00","updated_at":"2020-09-24T17:57:03.722+08:00"},{"id":3317163,"file_name":"bg.jpg","project_id":193851,"asset_id":266316,"created_at":"2020-09-24T17:57:03.730+08:00","updated_at":"2020-09-24T17:57:03.730+08:00"},{"id":3317164,"file_name":"swing_1.png","project_id":193851,"asset_id":266317,"created_at":"2020-09-24T17:57:03.734+08:00","updated_at":"2020-09-24T17:57:03.734+08:00"},{"id":3317165,"file_name":"swing_0.png","project_id":193851,"asset_id":266318,"created_at":"2020-09-24T17:57:03.738+08:00","updated_at":"2020-09-24T17:57:03.738+08:00"},{"id":3317166,"file_name":"0.png","project_id":193851,"asset_id":266319,"created_at":"2020-09-24T17:57:03.742+08:00","updated_at":"2020-09-24T17:57:03.742+08:00"},{"id":3317167,"file_name":"1.png","project_id":193851,"asset_id":266320,"created_at":"2020-09-24T17:57:03.745+08:00","updated_at":"2020-09-24T17:57:03.745+08:00"},{"id":3317168,"file_name":"2.png","project_id":193851,"asset_id":266321,"created_at":"2020-09-24T17:57:03.749+08:00","updated_at":"2020-09-24T17:57:03.749+08:00"},{"id":3317169,"file_name":"3.png","project_id":193851,"asset_id":266322,"created_at":"2020-09-24T17:57:03.752+08:00","updated_at":"2020-09-24T17:57:03.752+08:00"},{"id":3317170,"file_name":"4.png","project_id":193851,"asset_id":266323,"created_at":"2020-09-24T17:57:03.756+08:00","updated_at":"2020-09-24T17:57:03.756+08:00"},{"id":3317171,"file_name":"5.png","project_id":193851,"asset_id":266324,"created_at":"2020-09-24T17:57:03.759+08:00","updated_at":"2020-09-24T17:57:03.759+08:00"},{"id":3317172,"file_name":"arrow_1.png","project_id":193851,"asset_id":266325,"created_at":"2020-09-24T17:57:03.763+08:00","updated_at":"2020-09-24T17:57:03.763+08:00"},{"id":3317173,"file_name":"archer.png","project_id":193851,"asset_id":266326,"created_at":"2020-09-24T17:57:03.766+08:00","updated_at":"2020-09-24T17:57:03.766+08:00"},{"id":3317174,"file_name":"arrow_0.png","project_id":193851,"asset_id":266327,"created_at":"2020-09-24T17:57:03.770+08:00","updated_at":"2020-09-24T17:57:03.770+08:00"},{"id":3317175,"file_name":"bow.png","project_id":193851,"asset_id":266328,"created_at":"2020-09-24T17:57:03.774+08:00","updated_at":"2020-09-24T17:57:03.774+08:00"},{"id":3317176,"file_name":"apple.png","project_id":193851,"asset_id":266329,"created_at":"2020-09-24T17:57:03.778+08:00","updated_at":"2020-09-24T17:57:03.778+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Screenshot
繁中
简中
English
日本語
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer