{"id":655570,"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\nswing.x = 900\napple.x = 900\nswing.y = 400\napple.y = 400\n\narcher.x = 300\nbow.x = 300\narrow.x = 300\n\narcher.y = 600\nbow.y = 600\narrow.y = 600\n\nbow.direction = 135\narrow.direction = 135\n\nlife.costume_id = 5\nlife.x = 200\nlife.y = 75\n\nactive = False #紀錄是否拉過弓\nscore = 0 #玩家得分\nvy = 0 #目標移動速度\n\ndef loop ():\n global active, score, vy\n \n #按住滑鼠拉動弓箭\n if cursor.is_down == True and arrow.direction \u003e 30 and arrow.x == 300:\n arrow.direction -= 2 #箭逆時間旋轉\n bow.direction -= 2 #弓逆時間旋轉\n active = True\n \n #放開滑鼠且已經拉過弓箭\n if cursor.is_down == False and active == True:\n arrow.step_forward(25) #箭向前移動\n arrow.direction += 1 #箭順時間旋轉\n\n #如果箭碰到蘋果\n if arrow.touched(apple):\n arrow.costume_id = 1 #切換到插著蘋果的造型\n apple.hidden = True #隱藏蘋果\n score += 1\n \n #如果超出場景下方或右邊邊界\n if arrow.y \u003e 900 or arrow.x \u003e 1300:\n arrow.move_to(300, 600)\n arrow.direction = 135\n bow.direction = 135\n active = False\n apple.hidden = False\n \n #必須寫在箭重置造型前面\n if arrow.costume_id == 1:\n rand = random.randrange(200, 700)\n swing.y = rand\n apple.y = rand\n if score \u003e= 10: vy = random.randrange(-5, 5)\n else:\n life.costume_id -= 1\n\n arrow.costume_id = 0 #切換成沒有蘋果的造型\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 swing.y \u003c 200 or swing.y \u003e 700: vy = -vy\n swing.y -= vy\n apple.y -= vy\n \n if arrow.touched(swing):\n swing.costume_id = 1\n else:\n swing.costume_id = 0\n\ngame.forever(loop) #重複不斷執行\n","created_at":"2023-12-05T10:46:12.676+08:00","updated_at":"2023-12-05T10:46:46.044+08:00","name":"射蘋果高手 - 開始後用滑鼠點擊舞台以啟用按鍵,重整畫面即可重新遊戲。 副本","language":"python","screenshot":{"url":"/uploads/project/screenshot/655570/9f4c6f98d15157f3194dece7190aac5b.jpg"},"parent_id":194473,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":359,"hashid":"ej9sewzry","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":14710468,"file_name":"gameover.png","project_id":655570,"asset_id":267885,"created_at":"2023-12-05T10:46:12.683+08:00","updated_at":"2023-12-05T10:46:12.683+08:00"},{"id":14710469,"file_name":"bg.jpg","project_id":655570,"asset_id":267886,"created_at":"2023-12-05T10:46:12.684+08:00","updated_at":"2023-12-05T10:46:12.684+08:00"},{"id":14710470,"file_name":"swing_1.png","project_id":655570,"asset_id":267887,"created_at":"2023-12-05T10:46:12.686+08:00","updated_at":"2023-12-05T10:46:12.686+08:00"},{"id":14710471,"file_name":"swing_0.png","project_id":655570,"asset_id":267888,"created_at":"2023-12-05T10:46:12.687+08:00","updated_at":"2023-12-05T10:46:12.687+08:00"},{"id":14710472,"file_name":"0.png","project_id":655570,"asset_id":267889,"created_at":"2023-12-05T10:46:12.688+08:00","updated_at":"2023-12-05T10:46:12.688+08:00"},{"id":14710473,"file_name":"1.png","project_id":655570,"asset_id":267890,"created_at":"2023-12-05T10:46:12.689+08:00","updated_at":"2023-12-05T10:46:12.689+08:00"},{"id":14710474,"file_name":"2.png","project_id":655570,"asset_id":267891,"created_at":"2023-12-05T10:46:12.690+08:00","updated_at":"2023-12-05T10:46:12.690+08:00"},{"id":14710475,"file_name":"3.png","project_id":655570,"asset_id":267892,"created_at":"2023-12-05T10:46:12.691+08:00","updated_at":"2023-12-05T10:46:12.691+08:00"},{"id":14710476,"file_name":"4.png","project_id":655570,"asset_id":267893,"created_at":"2023-12-05T10:46:12.692+08:00","updated_at":"2023-12-05T10:46:12.692+08:00"},{"id":14710477,"file_name":"5.png","project_id":655570,"asset_id":267894,"created_at":"2023-12-05T10:46:12.694+08:00","updated_at":"2023-12-05T10:46:12.694+08:00"},{"id":14710478,"file_name":"arrow_1.png","project_id":655570,"asset_id":267895,"created_at":"2023-12-05T10:46:12.695+08:00","updated_at":"2023-12-05T10:46:12.695+08:00"},{"id":14710479,"file_name":"archer.png","project_id":655570,"asset_id":267896,"created_at":"2023-12-05T10:46:12.696+08:00","updated_at":"2023-12-05T10:46:12.696+08:00"},{"id":14710480,"file_name":"arrow_0.png","project_id":655570,"asset_id":267897,"created_at":"2023-12-05T10:46:12.697+08:00","updated_at":"2023-12-05T10:46:12.697+08:00"},{"id":14710481,"file_name":"bow.png","project_id":655570,"asset_id":267898,"created_at":"2023-12-05T10:46:12.698+08:00","updated_at":"2023-12-05T10:46:12.698+08:00"},{"id":14710482,"file_name":"apple.png","project_id":655570,"asset_id":267899,"created_at":"2023-12-05T10:46:12.700+08:00","updated_at":"2023-12-05T10:46:12.700+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