{"id":752058,"student_id":44333,"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.y = 600\narcher.x = 300\nbow.y = 600\nbow.x = 300\narrow.y = 600\narrow.x = 300\n\nbow.direction = 135\narrow.direction = 135\nactive = False #紀錄是否拉過弓\nscore = 0 #玩家得分\nvy = 0 #目標移動速度\n\n#遊戲主迴圈\ndef loop ():\n global active, score, vy\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 if arrow.touched(apple):\n apple.hidden = True\n arrow.costume_id = 1\n score += 1\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 if arrow.costume_id == 1: #如果是插著蘋果的造型\n rand = random.randrange(300, 600)\n swing.y = rand\n apple.y = rand\n else:\n life.costume_id -= 1\n \n \n arrow.costume_id = 0\n \n \n if life.costume_id == 0:\n game.create_sprite('gameover.png')\n game.stop()\n game.draw_text(score, 1080, 50, 'white', 60)\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":"2024-05-18T10:50:49.410+08:00","updated_at":"2024-05-18T12:01:43.407+08:00","name":"射箭遊戲(預設版) 副本","language":"python","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/752058/c3f511e604fd52ac6ea6f827735c4ae3.jpg"},"parent_id":194470,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":2,"hashid":"d5msnd9g6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16797448,"file_name":"gameover.png","project_id":752058,"asset_id":267838,"created_at":"2024-05-18T10:50:49.416+08:00","updated_at":"2024-05-18T10:50:49.416+08:00"},{"id":16797449,"file_name":"bg.jpg","project_id":752058,"asset_id":267839,"created_at":"2024-05-18T10:50:49.417+08:00","updated_at":"2024-05-18T10:50:49.417+08:00"},{"id":16797450,"file_name":"swing_1.png","project_id":752058,"asset_id":267840,"created_at":"2024-05-18T10:50:49.418+08:00","updated_at":"2024-05-18T10:50:49.418+08:00"},{"id":16797451,"file_name":"swing_0.png","project_id":752058,"asset_id":267841,"created_at":"2024-05-18T10:50:49.420+08:00","updated_at":"2024-05-18T10:50:49.420+08:00"},{"id":16797452,"file_name":"0.png","project_id":752058,"asset_id":267842,"created_at":"2024-05-18T10:50:49.421+08:00","updated_at":"2024-05-18T10:50:49.421+08:00"},{"id":16797453,"file_name":"1.png","project_id":752058,"asset_id":267843,"created_at":"2024-05-18T10:50:49.422+08:00","updated_at":"2024-05-18T10:50:49.422+08:00"},{"id":16797454,"file_name":"2.png","project_id":752058,"asset_id":267844,"created_at":"2024-05-18T10:50:49.423+08:00","updated_at":"2024-05-18T10:50:49.423+08:00"},{"id":16797455,"file_name":"3.png","project_id":752058,"asset_id":267845,"created_at":"2024-05-18T10:50:49.424+08:00","updated_at":"2024-05-18T10:50:49.424+08:00"},{"id":16797456,"file_name":"4.png","project_id":752058,"asset_id":267846,"created_at":"2024-05-18T10:50:49.425+08:00","updated_at":"2024-05-18T10:50:49.425+08:00"},{"id":16797457,"file_name":"5.png","project_id":752058,"asset_id":267847,"created_at":"2024-05-18T10:50:49.426+08:00","updated_at":"2024-05-18T10:50:49.426+08:00"},{"id":16797458,"file_name":"arrow_1.png","project_id":752058,"asset_id":267848,"created_at":"2024-05-18T10:50:49.427+08:00","updated_at":"2024-05-18T10:50:49.427+08:00"},{"id":16797459,"file_name":"archer.png","project_id":752058,"asset_id":267849,"created_at":"2024-05-18T10:50:49.429+08:00","updated_at":"2024-05-18T10:50:49.429+08:00"},{"id":16797460,"file_name":"arrow_0.png","project_id":752058,"asset_id":267850,"created_at":"2024-05-18T10:50:49.430+08:00","updated_at":"2024-05-18T10:50:49.430+08:00"},{"id":16797461,"file_name":"bow.png","project_id":752058,"asset_id":267851,"created_at":"2024-05-18T10:50:49.431+08:00","updated_at":"2024-05-18T10:50:49.431+08:00"},{"id":16797462,"file_name":"apple.png","project_id":752058,"asset_id":267852,"created_at":"2024-05-18T10:50:49.432+08:00","updated_at":"2024-05-18T10:50:49.432+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦