{"id":222324,"student_id":2002,"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') #箭\narrow_active = True\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\narcher.x = 300\narcher.y = 600\nbow.x = 300\nbow.y = 600\narrow.x = 300\narrow.y = 600\nbow.direction = 135\narrow.direction = 135\nlife.x = 200\nlife.y = 75\nlife.costume_id = 5\n\n\nactive = False #紀錄是否拉過弓\nscore = 0 #玩家得分\nvy = 0 #目標移動速度\n\n#遊戲主迴圈\ndef loop ():\n global active, score, vy, arrow_active\n game.draw_text(score, 1080, 50, \"white\", 60)\n if game.cursor.is_down == True and bow.direction \u003e 30 and arrow_active == True:\n bow.direction -= 2\n arrow.direction -= 2\n active = True\n if game.cursor.is_down == False and active == True:\n arrow.step_forward(25)\n arrow.direction += 1\n arrow_active = False\n if arrow.touched(apple):\n apple.hidden = True\n score += 1\n arrow.costume_id = 1\n if arrow.x \u003e 1200 or arrow.y \u003e 900:\n arrow.x = 300\n arrow.y = 600\n apple.hidden = False\n arrow.direction = 135\n bow.direction = 135\n active = False\n arrow_active = True\n if arrow.costume_id == 1:\n rand = random.randrange(200, 701)\n apple.y = rand\n swing.y = rand\n else:\n life.costume_id -= 1\n arrow.costume_id = 0\n if arrow.touched(swing):\n swing.costume_id = 1\n if score \u003e= 10:\n vy = random.randrange(-5, 6)\n else:\n swing.costume_id = 0\n if apple.y \u003c 200 or apple.y \u003e 700:\n vy = -vy\n apple.y += vy\n swing.y += vy\n if life.costume_id == 0:\n game.create_sprite(\"gameover.png\") #創造角色\n stop()\ngame.forever(loop) #重複不斷執行\n","created_at":"2021-01-24T13:20:53.487+08:00","updated_at":"2021-01-24T14:30:09.746+08:00","name":"射箭遊戲(預設版) 副本","language":"python","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/222324/2f50f612c5323cb091a2bd409bcce8dd.jpg"},"parent_id":194470,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":166,"hashid":"wdks4wv5y","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3961917,"file_name":"gameover.png","project_id":222324,"asset_id":267838,"created_at":"2021-01-24T13:20:53.492+08:00","updated_at":"2021-01-24T13:20:53.492+08:00"},{"id":3961918,"file_name":"bg.jpg","project_id":222324,"asset_id":267839,"created_at":"2021-01-24T13:20:53.493+08:00","updated_at":"2021-01-24T13:20:53.493+08:00"},{"id":3961919,"file_name":"swing_1.png","project_id":222324,"asset_id":267840,"created_at":"2021-01-24T13:20:53.494+08:00","updated_at":"2021-01-24T13:20:53.494+08:00"},{"id":3961920,"file_name":"swing_0.png","project_id":222324,"asset_id":267841,"created_at":"2021-01-24T13:20:53.495+08:00","updated_at":"2021-01-24T13:20:53.495+08:00"},{"id":3961921,"file_name":"0.png","project_id":222324,"asset_id":267842,"created_at":"2021-01-24T13:20:53.496+08:00","updated_at":"2021-01-24T13:20:53.496+08:00"},{"id":3961922,"file_name":"1.png","project_id":222324,"asset_id":267843,"created_at":"2021-01-24T13:20:53.497+08:00","updated_at":"2021-01-24T13:20:53.497+08:00"},{"id":3961923,"file_name":"2.png","project_id":222324,"asset_id":267844,"created_at":"2021-01-24T13:20:53.498+08:00","updated_at":"2021-01-24T13:20:53.498+08:00"},{"id":3961924,"file_name":"3.png","project_id":222324,"asset_id":267845,"created_at":"2021-01-24T13:20:53.499+08:00","updated_at":"2021-01-24T13:20:53.499+08:00"},{"id":3961925,"file_name":"4.png","project_id":222324,"asset_id":267846,"created_at":"2021-01-24T13:20:53.500+08:00","updated_at":"2021-01-24T13:20:53.500+08:00"},{"id":3961926,"file_name":"5.png","project_id":222324,"asset_id":267847,"created_at":"2021-01-24T13:20:53.501+08:00","updated_at":"2021-01-24T13:20:53.501+08:00"},{"id":3961927,"file_name":"arrow_1.png","project_id":222324,"asset_id":267848,"created_at":"2021-01-24T13:20:53.502+08:00","updated_at":"2021-01-24T13:20:53.502+08:00"},{"id":3961928,"file_name":"archer.png","project_id":222324,"asset_id":267849,"created_at":"2021-01-24T13:20:53.502+08:00","updated_at":"2021-01-24T13:20:53.502+08:00"},{"id":3961929,"file_name":"arrow_0.png","project_id":222324,"asset_id":267850,"created_at":"2021-01-24T13:20:53.503+08:00","updated_at":"2021-01-24T13:20:53.503+08:00"},{"id":3961930,"file_name":"bow.png","project_id":222324,"asset_id":267851,"created_at":"2021-01-24T13:20:53.504+08:00","updated_at":"2021-01-24T13:20:53.504+08:00"},{"id":3961931,"file_name":"apple.png","project_id":222324,"asset_id":267852,"created_at":"2021-01-24T13:20:53.505+08:00","updated_at":"2021-01-24T13:20:53.505+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦