{"id":857576,"student_id":2589,"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') #遊戲說明\ncreate_sound('bgm.mp3', True) #背景音樂\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 = 0 #垂直速度\nangle = 0 #旋轉角度\nturns = 0 #旋轉圈數\n\ndef start():\n global vy\n vy = 25\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 if cursor.is_down: # 當滑鼠按下時\n player.toward(cursor) #讓叩叮朝向滑鼠\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 \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 # 當角色墜落並且在彈簧床碰撞範圍內時就反彈\n if player.y \u003e jumper.y and jumper.x \u003e 200 and jumper.x \u003c 1000 and vy \u003c 0:\n if player.direction \u003c 180:\n vx = -player.direction / 10\n vy = -vy + vx\n else:\n vx = (360 - player.direction) / 10\n vy = -vy - vx\n \n speed += 0.05\n \n if player.y \u003e jumper.y + 200:\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 create_sound('bell.mp3')\n\non('keydown', 'space', start)\nforever(loop)\n","created_at":"2024-10-07T12:01:22.035+08:00","updated_at":"2024-10-07T12:03:44.394+08:00","name":"5_彈簧床高手_完整版","language":"python","screenshot":{"url":null},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":5,"hashid":"wdksmznnq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":18806279,"file_name":"bgm.mp3","project_id":857576,"asset_id":781610,"created_at":"2024-10-07T12:01:32.113+08:00","updated_at":"2024-10-07T12:01:32.113+08:00"},{"id":18806280,"file_name":"bell.mp3","project_id":857576,"asset_id":781611,"created_at":"2024-10-07T12:01:32.121+08:00","updated_at":"2024-10-07T12:01:32.121+08:00"},{"id":18806281,"file_name":"p_0.png","project_id":857576,"asset_id":781612,"created_at":"2024-10-07T12:01:32.128+08:00","updated_at":"2024-10-07T12:01:32.128+08:00"},{"id":18806282,"file_name":"p_1.png","project_id":857576,"asset_id":781613,"created_at":"2024-10-07T12:01:32.133+08:00","updated_at":"2024-10-07T12:01:32.133+08:00"},{"id":18806283,"file_name":"trampoline_0.png","project_id":857576,"asset_id":781614,"created_at":"2024-10-07T12:01:32.139+08:00","updated_at":"2024-10-07T12:01:32.139+08:00"},{"id":18806284,"file_name":"trampoline_1.png","project_id":857576,"asset_id":781615,"created_at":"2024-10-07T12:01:32.145+08:00","updated_at":"2024-10-07T12:01:32.145+08:00"},{"id":18806285,"file_name":"reset_btn.png","project_id":857576,"asset_id":781616,"created_at":"2024-10-07T12:01:32.150+08:00","updated_at":"2024-10-07T12:01:32.150+08:00"},{"id":18806286,"file_name":"rules.png","project_id":857576,"asset_id":781617,"created_at":"2024-10-07T12:01:32.157+08:00","updated_at":"2024-10-07T12:01:32.157+08:00"},{"id":18806287,"file_name":"p_2.png","project_id":857576,"asset_id":781618,"created_at":"2024-10-07T12:01:32.162+08:00","updated_at":"2024-10-07T12:01:32.162+08:00"},{"id":18806288,"file_name":"p_3.png","project_id":857576,"asset_id":781619,"created_at":"2024-10-07T12:01:32.167+08:00","updated_at":"2024-10-07T12:01:32.167+08:00"},{"id":18806289,"file_name":"bg.png","project_id":857576,"asset_id":781620,"created_at":"2024-10-07T12:01:32.180+08:00","updated_at":"2024-10-07T12:01:32.180+08:00"},{"id":18806290,"file_name":"board.png","project_id":857576,"asset_id":781621,"created_at":"2024-10-07T12:01:32.185+08:00","updated_at":"2024-10-07T12:01:32.185+08:00"},{"id":18806291,"file_name":"pie_b.png","project_id":857576,"asset_id":781622,"created_at":"2024-10-07T12:01:32.190+08:00","updated_at":"2024-10-07T12:01:32.190+08:00"},{"id":18806292,"file_name":"star.png","project_id":857576,"asset_id":781623,"created_at":"2024-10-07T12:01:32.195+08:00","updated_at":"2024-10-07T12:01:32.195+08:00"},{"id":18806293,"file_name":"pie_r.png","project_id":857576,"asset_id":781624,"created_at":"2024-10-07T12:01:32.199+08:00","updated_at":"2024-10-07T12:01:32.199+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦