{"id":222327,"student_id":1940,"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= 3: 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 arrow.touched(swing):\n swing.costume_id = 1\n else:\n swing.costume_id = 0\n if swing.y \u003c 200 or swing.y \u003e 700: vy = -vy\n swing.y -= vy\n apple.y -= vy\n\ngame.forever(loop) #重複不斷執行\n\n","created_at":"2021-01-24T13:29:35.749+08:00","updated_at":"2021-01-24T15:11:51.545+08:00","name":"射箭遊戲(預設版) 副本","language":"python","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/222327/094bc166983c054898072776e3f1f710.jpg"},"parent_id":194470,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":69,"hashid":"882sqnyny","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3961959,"file_name":"gameover.png","project_id":222327,"asset_id":267838,"created_at":"2021-01-24T13:29:35.754+08:00","updated_at":"2021-01-24T13:29:35.754+08:00"},{"id":3961960,"file_name":"bg.jpg","project_id":222327,"asset_id":267839,"created_at":"2021-01-24T13:29:35.755+08:00","updated_at":"2021-01-24T13:29:35.755+08:00"},{"id":3961961,"file_name":"swing_1.png","project_id":222327,"asset_id":267840,"created_at":"2021-01-24T13:29:35.756+08:00","updated_at":"2021-01-24T13:29:35.756+08:00"},{"id":3961962,"file_name":"swing_0.png","project_id":222327,"asset_id":267841,"created_at":"2021-01-24T13:29:35.757+08:00","updated_at":"2021-01-24T13:29:35.757+08:00"},{"id":3961963,"file_name":"0.png","project_id":222327,"asset_id":267842,"created_at":"2021-01-24T13:29:35.758+08:00","updated_at":"2021-01-24T13:29:35.758+08:00"},{"id":3961964,"file_name":"1.png","project_id":222327,"asset_id":267843,"created_at":"2021-01-24T13:29:35.759+08:00","updated_at":"2021-01-24T13:29:35.759+08:00"},{"id":3961965,"file_name":"2.png","project_id":222327,"asset_id":267844,"created_at":"2021-01-24T13:29:35.760+08:00","updated_at":"2021-01-24T13:29:35.760+08:00"},{"id":3961966,"file_name":"3.png","project_id":222327,"asset_id":267845,"created_at":"2021-01-24T13:29:35.761+08:00","updated_at":"2021-01-24T13:29:35.761+08:00"},{"id":3961967,"file_name":"4.png","project_id":222327,"asset_id":267846,"created_at":"2021-01-24T13:29:35.762+08:00","updated_at":"2021-01-24T13:29:35.762+08:00"},{"id":3961968,"file_name":"5.png","project_id":222327,"asset_id":267847,"created_at":"2021-01-24T13:29:35.763+08:00","updated_at":"2021-01-24T13:29:35.763+08:00"},{"id":3961969,"file_name":"arrow_1.png","project_id":222327,"asset_id":267848,"created_at":"2021-01-24T13:29:35.764+08:00","updated_at":"2021-01-24T13:29:35.764+08:00"},{"id":3961970,"file_name":"archer.png","project_id":222327,"asset_id":267849,"created_at":"2021-01-24T13:29:35.765+08:00","updated_at":"2021-01-24T13:29:35.765+08:00"},{"id":3961971,"file_name":"arrow_0.png","project_id":222327,"asset_id":267850,"created_at":"2021-01-24T13:29:35.766+08:00","updated_at":"2021-01-24T13:29:35.766+08:00"},{"id":3961972,"file_name":"bow.png","project_id":222327,"asset_id":267851,"created_at":"2021-01-24T13:29:35.767+08:00","updated_at":"2021-01-24T13:29:35.767+08:00"},{"id":3961973,"file_name":"apple.png","project_id":222327,"asset_id":267852,"created_at":"2021-01-24T13:29:35.768+08:00","updated_at":"2021-01-24T13:29:35.768+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦