{"id":237809,"student_id":2002,"content":"import random #載入隨機數模組\nfrom game import (\n set_backdrop, #設定背景圖\n create_sprite, #創造角色\n create_sound, #創造音效\n draw_text, #繪製文字\n key, #鍵盤狀態\n forever, #重複不斷執行\n stop, #遊戲結束\n)\n\nset_backdrop('bg.jpg') #設定背景圖\nlevels = create_sprite('0.png','1.png','2.png','3.png','4.png','5.png','6.png','7.png','8.png','9.png') #關卡地形\nbar = create_sprite('bar.png') #生命條\ndashboard = create_sprite('dashboard.png') #生命條框\n\nplayer = create_sprite('player.png') #玩家\ntarget = create_sprite('target.png') #目標\ninfo = create_sprite('arrow.png', 'youwin.png', 'gameover.png') #文字圖\n\nbar.move_to(250, 46) #初始化位置\nplayer.layer = 1 #設定玩家圖層到最上層\ninfo.hidden = True #預設隱藏箭頭示意\ntarget.move_to(1000, 700)\n\nfuel = 1000\nvy = 0\nvx = 0\n\ngoal_x = [1000, 1000, 200, 200, 1000, 1000, 1000, 600, 1100, -100]\ngoal_y = [700, 200, 700, 200, 200, 800, 200, 450, 700, -100]\n\ninfo.hidden = False\nsupermod = False\n\n#遊戲主迴圈\ndef loop ():\n global vx, vy, is_start, fuel, supermod\n if key.space:\n supermod = True\n if supermod == True:\n fuel = 999\n if info.hidden == True:\n player.y += vy\n vy += 0.07\n player.x += vx\n if key.up and fuel \u003e 0:\n vy -= 0.15\n if supermod == False:\n bar.x -= 0.5\n fuel -= 1\n info.hidden = True\n if key.right and fuel \u003e 0:\n vx += 0.1\n if supermod == False:\n bar.x -= 0.5\n fuel -= 1\n info.hidden = True\n if key.left and fuel \u003e 0:\n vx -= 0.1\n if supermod == False:\n bar.x -= 0.5\n fuel -= 1\n \n vx *= 0.99\n if player.touched(target):\n levels.costume_id += 1\n bar.move_to(250, 46)\n fuel = 1000\n target.move_to(goal_x[levels.costume_id], goal_y[levels.costume_id])\n if levels.costume_id == 9:\n info.hidden = False\n info.costume_id = 1\n stop()\n if supermod == False:\n if player.touched(levels):\n info.hidden = False\n info.costume_id = 2\n stop()\n draw_text(fuel, 50, 30, \"black\", 30)\n player.direction = 90 + vx * 2.5\n if key.up or key.right or key.left:\n if fuel % 3 == 0 and fuel \u003e 0: create_flame()\n\n#創造火焰球\ndef create_flame ():\n flame = create_sprite(\"flame.png\") #創造角色\n flame.x = player.x\n flame.y = player.y + 50\n flame.direction = player.direction + 90 + random.randrange(-15, 16)\n def flameloop ():\n flame.step_forward(5)\n flame.opacity -= 0.01\n flame.scale -= 0.01\n if flame.opacity == 0 or flame.scale == 0 or flame.touched(levels):\n flame.destroy()\n flame.forever(flameloop)\nforever(loop) #重複不斷執行遊戲回圈\n","created_at":"2021-03-21T13:32:31.633+08:00","updated_at":"2021-03-21T15:14:24.217+08:00","name":"太空人(預設版) 副本","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/237809/d5cf409fb218a57d3c64cc25ef2b6254.jpg"},"parent_id":183414,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":38,"hashid":"npms3wvee","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4337211,"file_name":"youwin.png","project_id":237809,"asset_id":251788,"created_at":"2021-03-21T13:32:31.640+08:00","updated_at":"2021-03-21T13:32:31.640+08:00"},{"id":4337212,"file_name":"target.png","project_id":237809,"asset_id":251789,"created_at":"2021-03-21T13:32:31.641+08:00","updated_at":"2021-03-21T13:32:31.641+08:00"},{"id":4337213,"file_name":"player.png","project_id":237809,"asset_id":251790,"created_at":"2021-03-21T13:32:31.643+08:00","updated_at":"2021-03-21T13:32:31.643+08:00"},{"id":4337214,"file_name":"gameover.png","project_id":237809,"asset_id":251791,"created_at":"2021-03-21T13:32:31.644+08:00","updated_at":"2021-03-21T13:32:31.644+08:00"},{"id":4337215,"file_name":"flame.png","project_id":237809,"asset_id":251792,"created_at":"2021-03-21T13:32:31.645+08:00","updated_at":"2021-03-21T13:32:31.645+08:00"},{"id":4337216,"file_name":"dashboard.png","project_id":237809,"asset_id":251793,"created_at":"2021-03-21T13:32:31.646+08:00","updated_at":"2021-03-21T13:32:31.646+08:00"},{"id":4337217,"file_name":"bg.jpg","project_id":237809,"asset_id":251794,"created_at":"2021-03-21T13:32:31.647+08:00","updated_at":"2021-03-21T13:32:31.647+08:00"},{"id":4337218,"file_name":"bar.png","project_id":237809,"asset_id":251795,"created_at":"2021-03-21T13:32:31.648+08:00","updated_at":"2021-03-21T13:32:31.648+08:00"},{"id":4337219,"file_name":"arrow.png","project_id":237809,"asset_id":251796,"created_at":"2021-03-21T13:32:31.649+08:00","updated_at":"2021-03-21T13:32:31.649+08:00"},{"id":4337220,"file_name":"0.png","project_id":237809,"asset_id":251797,"created_at":"2021-03-21T13:32:31.651+08:00","updated_at":"2021-03-21T13:32:31.651+08:00"},{"id":4337221,"file_name":"1.png","project_id":237809,"asset_id":251798,"created_at":"2021-03-21T13:32:31.652+08:00","updated_at":"2021-03-21T13:32:31.652+08:00"},{"id":4337222,"file_name":"2.png","project_id":237809,"asset_id":251799,"created_at":"2021-03-21T13:32:31.654+08:00","updated_at":"2021-03-21T13:32:31.654+08:00"},{"id":4337223,"file_name":"3.png","project_id":237809,"asset_id":251800,"created_at":"2021-03-21T13:32:31.655+08:00","updated_at":"2021-03-21T13:32:31.655+08:00"},{"id":4337224,"file_name":"4.png","project_id":237809,"asset_id":251801,"created_at":"2021-03-21T13:32:31.656+08:00","updated_at":"2021-03-21T13:32:31.656+08:00"},{"id":4337225,"file_name":"5.png","project_id":237809,"asset_id":251802,"created_at":"2021-03-21T13:32:31.657+08:00","updated_at":"2021-03-21T13:32:31.657+08:00"},{"id":4337226,"file_name":"6.png","project_id":237809,"asset_id":251803,"created_at":"2021-03-21T13:32:31.658+08:00","updated_at":"2021-03-21T13:32:31.658+08:00"},{"id":4337227,"file_name":"7.png","project_id":237809,"asset_id":251804,"created_at":"2021-03-21T13:32:31.660+08:00","updated_at":"2021-03-21T13:32:31.660+08:00"},{"id":4337228,"file_name":"8.png","project_id":237809,"asset_id":251805,"created_at":"2021-03-21T13:32:31.661+08:00","updated_at":"2021-03-21T13:32:31.661+08:00"},{"id":4337229,"file_name":"9.png","project_id":237809,"asset_id":251806,"created_at":"2021-03-21T13:32:31.662+08:00","updated_at":"2021-03-21T13:32:31.662+08:00"},{"id":4337230,"file_name":"bgm.mp3","project_id":237809,"asset_id":251807,"created_at":"2021-03-21T13:32:31.663+08:00","updated_at":"2021-03-21T13:32:31.663+08:00"},{"id":4337231,"file_name":"effect.wav","project_id":237809,"asset_id":251808,"created_at":"2021-03-21T13:32:31.665+08:00","updated_at":"2021-03-21T13:32:31.665+08:00"},{"id":4337232,"file_name":"coin.wav","project_id":237809,"asset_id":251809,"created_at":"2021-03-21T13:32:31.667+08:00","updated_at":"2021-03-21T13:32:31.667+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦