{"id":794551,"student_id":10,"content":"from game import *\n\nbg = create_sprite('bg.png') #背景圖\njumper = create_sprite('trampoline_0.png', 'trampoline_1.png') #彈簧床\nplayer = create_sprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png') #玩家\npie_r = create_sprite('pie_r.png') #偵測右轉色塊\npie_l = create_sprite('pie_b.png') #偵測左轉色塊\nboard = create_sprite('board.png') #計分板\nrules = create_sprite('rules.png') #遊戲說明\n\nbg.y = -1350\npie_r.opacity = 0.01 #偵測右轉色塊變幾乎透明\npie_l.opacity = 0.01 #偵測左轉色塊變幾乎透明\nplayer.direction = 0 #讓玩家頭朝上\nboard.move_to(150, 50)\nboard.hidden = True\n\nspeed = 1 #遊戲速度\ngravity = 0.1 #地心引力\nvx = 0 #水平速度\nvy = 20 #垂直速度\nangle = 0 #旋轉角度\nturns = 0 #旋轉圈數\n\ndef start():\n rules.hidden = True\n board.hidden = False\n\n#遊戲迴圈\ndef loop():\n global vx, vy, angle, turns\n if rules.hidden: #當遊戲說明隱藏\n update_cotumes() #更新角色角色\n update_player() #相對玩家移動\n update_pie() #偵測旋轉角度\n draw_text(str(turns) + '圈', 50, 30, 'white', 50)\n\n#更新角色造型\ndef update_cotumes():\n if player.touched(jumper):\n player.costume_id = 0\n jumper.costume_id = 1\n else:\n player.costume_id = (player.y // 100) % 2 + 1\n jumper.costume_id = 0\n\n#相對玩家移動\ndef update_player():\n global vx, vy, speed\n bg.x += vx * speed\n bg.y += vy * speed\n jumper.x += vx * speed\n jumper.y += vy * speed\n vy -= gravity * speed\n \n if cursor.is_down:\n player.toward(cursor)\n \n if player.y \u003e jumper.y - 200 and jumper.x \u003e 200 and jumper.x \u003c 1000:\n if player.direction \u003c 180:\n vx = -player.direction / 15\n vy = 25 + vx * 2\n else:\n vx = (360 - player.direction) / 15\n vy = 25 - vx * 2\n \n speed += 0.05\n \n if player.y \u003e jumper.y:\n player.costume_id = 3\n stop()\n \n#偵測旋轉角度\ndef update_pie():\n global angle, turns\n \n if pie_r.touched(cursor):\n pie_r.direction += 120\n pie_l.direction += 120\n angle += 120\n \n if pie_l.touched(cursor):\n pie_r.direction -= 120\n pie_l.direction -= 120\n angle -= 120\n \n if angle == 360 or angle == -360:\n angle = 0\n turns += 1\n\nrules.on('click', start)\nforever(loop)\n\n\n","created_at":"2024-07-17T12:12:05.795+08:00","updated_at":"2024-07-17T12:19:28.212+08:00","name":"彈簧床高手 副本","language":"python","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/794551/93b984357d63863eafc23c0cae6ee924.jpg"},"parent_id":793580,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":44,"hashid":"rdvsd62y2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":17629334,"file_name":"p_0.png","project_id":794551,"asset_id":756190,"created_at":"2024-07-17T12:12:05.804+08:00","updated_at":"2024-07-17T12:12:05.804+08:00"},{"id":17629335,"file_name":"p_1.png","project_id":794551,"asset_id":756191,"created_at":"2024-07-17T12:12:05.806+08:00","updated_at":"2024-07-17T12:12:05.806+08:00"},{"id":17629336,"file_name":"trampoline_0.png","project_id":794551,"asset_id":756196,"created_at":"2024-07-17T12:12:05.807+08:00","updated_at":"2024-07-17T12:12:05.807+08:00"},{"id":17629337,"file_name":"trampoline_1.png","project_id":794551,"asset_id":756197,"created_at":"2024-07-17T12:12:05.808+08:00","updated_at":"2024-07-17T12:12:05.808+08:00"},{"id":17629338,"file_name":"reset_btn.png","project_id":794551,"asset_id":756194,"created_at":"2024-07-17T12:12:05.809+08:00","updated_at":"2024-07-17T12:12:05.809+08:00"},{"id":17629339,"file_name":"rules.png","project_id":794551,"asset_id":756195,"created_at":"2024-07-17T12:12:05.815+08:00","updated_at":"2024-07-17T12:12:05.815+08:00"},{"id":17629340,"file_name":"p_2.png","project_id":794551,"asset_id":756192,"created_at":"2024-07-17T12:12:05.816+08:00","updated_at":"2024-07-17T12:12:05.816+08:00"},{"id":17629341,"file_name":"p_3.png","project_id":794551,"asset_id":756193,"created_at":"2024-07-17T12:12:05.817+08:00","updated_at":"2024-07-17T12:12:05.817+08:00"},{"id":17629342,"file_name":"bg.png","project_id":794551,"asset_id":756188,"created_at":"2024-07-17T12:12:05.818+08:00","updated_at":"2024-07-17T12:12:05.818+08:00"},{"id":17629343,"file_name":"board.png","project_id":794551,"asset_id":756189,"created_at":"2024-07-17T12:12:05.819+08:00","updated_at":"2024-07-17T12:12:05.819+08:00"},{"id":17629344,"file_name":"pie_b.png","project_id":794551,"asset_id":756250,"created_at":"2024-07-17T12:12:05.820+08:00","updated_at":"2024-07-17T12:12:05.820+08:00"},{"id":17629345,"file_name":"star.png","project_id":794551,"asset_id":756268,"created_at":"2024-07-17T12:12:05.821+08:00","updated_at":"2024-07-17T12:12:05.821+08:00"},{"id":17629346,"file_name":"pie_r.png","project_id":794551,"asset_id":756249,"created_at":"2024-07-17T12:12:05.822+08:00","updated_at":"2024-07-17T12:12:05.822+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦