{"id":337995,"student_id":10,"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 #預設隱藏箭頭示意\n\nvy = 0 #垂直速度\nvx = 0 #水平速度\nfuel = 1000 #燃料\n\n\n#遊戲主迴圈\ndef loop ():\n global vx, vy, is_start, fuel\n \n vy += 0.07 #向下加速\n player.y += vy #根據 vy 數值改變垂直位置\n player.x += vx #根據 vx 數值改變水平位置\n \n if key.up:\n vy -= 0.15 #向上加速\n \n if key.right:\n vx += 0.1 #向右加速\n \n if key.left:\n vx -= 0.1 #水向左加速\n \n vx = vx * 0.99 #衰減水平速度\n \n #如果太空人碰到目標物就切換下個關卡\n\n\n\nforever(loop) #重複不斷執行遊戲回圈\n","created_at":"2022-01-17T11:52:44.441+08:00","updated_at":"2022-04-06T09:23:20.124+08:00","name":"太空人(預設版) ","language":"python","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/337995/c1449974dcdbb9efa6333c1d00ffe49b.jpg"},"parent_id":183414,"plugin":"#創造火焰球\n\n_clock = 0\n\ndef create_flames ():\n global _clock\n _clock += 1\n if (key.up or key.right or key.left) and _clock % 3 == 0 and fuel \u003e 0:\n f = create_sprite('flame.png')\n f.x = player.x\n f.y = player.y + 50\n f.direction = player.direction + 90 + random.randrange(-15, 15)\n \n def flameLoop ():\n f.opacity -= 0.01\n f.scale -= 0.01\n f.step_forward(5)\n if f.opacity \u003c= 0: f.destroy()\n\n f.forever(flameLoop)\n \n\nforever(create_flames)\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":169,"hashid":"4y3sg862d","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":7313792,"file_name":"coin.wav","project_id":337995,"asset_id":470829,"created_at":"2022-01-26T15:38:01.501+08:00","updated_at":"2022-01-26T15:38:01.501+08:00"},{"id":7313793,"file_name":"effect.wav","project_id":337995,"asset_id":470830,"created_at":"2022-01-26T15:38:01.510+08:00","updated_at":"2022-01-26T15:38:01.510+08:00"},{"id":7313794,"file_name":"bgm.mp3","project_id":337995,"asset_id":470831,"created_at":"2022-01-26T15:38:01.577+08:00","updated_at":"2022-01-26T15:38:01.577+08:00"},{"id":7313795,"file_name":"9.png","project_id":337995,"asset_id":470832,"created_at":"2022-01-26T15:38:01.583+08:00","updated_at":"2022-01-26T15:38:01.583+08:00"},{"id":7313796,"file_name":"8.png","project_id":337995,"asset_id":470833,"created_at":"2022-01-26T15:38:01.588+08:00","updated_at":"2022-01-26T15:38:01.588+08:00"},{"id":7313797,"file_name":"7.png","project_id":337995,"asset_id":470834,"created_at":"2022-01-26T15:38:01.592+08:00","updated_at":"2022-01-26T15:38:01.592+08:00"},{"id":7313798,"file_name":"6.png","project_id":337995,"asset_id":470835,"created_at":"2022-01-26T15:38:01.597+08:00","updated_at":"2022-01-26T15:38:01.597+08:00"},{"id":7313799,"file_name":"5.png","project_id":337995,"asset_id":470836,"created_at":"2022-01-26T15:38:01.602+08:00","updated_at":"2022-01-26T15:38:01.602+08:00"},{"id":7313800,"file_name":"4.png","project_id":337995,"asset_id":470837,"created_at":"2022-01-26T15:38:01.607+08:00","updated_at":"2022-01-26T15:38:01.607+08:00"},{"id":7313801,"file_name":"3.png","project_id":337995,"asset_id":470838,"created_at":"2022-01-26T15:38:01.611+08:00","updated_at":"2022-01-26T15:38:01.611+08:00"},{"id":7313802,"file_name":"2.png","project_id":337995,"asset_id":470839,"created_at":"2022-01-26T15:38:01.615+08:00","updated_at":"2022-01-26T15:38:01.615+08:00"},{"id":7313803,"file_name":"1.png","project_id":337995,"asset_id":470840,"created_at":"2022-01-26T15:38:01.619+08:00","updated_at":"2022-01-26T15:38:01.619+08:00"},{"id":7313804,"file_name":"0.png","project_id":337995,"asset_id":470841,"created_at":"2022-01-26T15:38:01.624+08:00","updated_at":"2022-01-26T15:38:01.624+08:00"},{"id":7313805,"file_name":"arrow.png","project_id":337995,"asset_id":470842,"created_at":"2022-01-26T15:38:01.628+08:00","updated_at":"2022-01-26T15:38:01.628+08:00"},{"id":7313806,"file_name":"bar.png","project_id":337995,"asset_id":470843,"created_at":"2022-01-26T15:38:01.631+08:00","updated_at":"2022-01-26T15:38:01.631+08:00"},{"id":7313807,"file_name":"bg.jpg","project_id":337995,"asset_id":470844,"created_at":"2022-01-26T15:38:01.636+08:00","updated_at":"2022-01-26T15:38:01.636+08:00"},{"id":7313808,"file_name":"dashboard.png","project_id":337995,"asset_id":470845,"created_at":"2022-01-26T15:38:01.646+08:00","updated_at":"2022-01-26T15:38:01.646+08:00"},{"id":7313809,"file_name":"flame.png","project_id":337995,"asset_id":470846,"created_at":"2022-01-26T15:38:01.650+08:00","updated_at":"2022-01-26T15:38:01.650+08:00"},{"id":7313810,"file_name":"gameover.png","project_id":337995,"asset_id":470847,"created_at":"2022-01-26T15:38:01.654+08:00","updated_at":"2022-01-26T15:38:01.654+08:00"},{"id":7313811,"file_name":"player.png","project_id":337995,"asset_id":470848,"created_at":"2022-01-26T15:38:01.659+08:00","updated_at":"2022-01-26T15:38:01.659+08:00"},{"id":7313812,"file_name":"target.png","project_id":337995,"asset_id":470849,"created_at":"2022-01-26T15:38:01.673+08:00","updated_at":"2022-01-26T15:38:01.673+08:00"},{"id":7313813,"file_name":"youwin.png","project_id":337995,"asset_id":470850,"created_at":"2022-01-26T15:38:01.678+08:00","updated_at":"2022-01-26T15:38:01.678+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦