{"id":888002,"student_id":1444,"content":"from game import *\n\nbg = create_sprite('bg.png') #背景圖\njumper = create_sprite('jumper_0.png', 'jumper_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-11-16T17:26:14.190+08:00","updated_at":"2024-11-16T17:28:29.251+08:00","name":"2_彈簧床高手_預設版 副本 副本","language":"python","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/888002/2fe13673b349cfb444886f49ded51788.jpg"},"parent_id":833891,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":8,"hashid":"9ygsr8kem","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":34545358,"file_name":"bgm.mp3","project_id":888002,"asset_id":771871,"created_at":"2024-11-16T17:26:14.195+08:00","updated_at":"2024-11-16T17:26:14.195+08:00"},{"id":34545359,"file_name":"bell.mp3","project_id":888002,"asset_id":771872,"created_at":"2024-11-16T17:26:14.196+08:00","updated_at":"2024-11-16T17:26:14.196+08:00"},{"id":34545360,"file_name":"p_0.png","project_id":888002,"asset_id":771873,"created_at":"2024-11-16T17:26:14.197+08:00","updated_at":"2024-11-16T17:26:14.197+08:00"},{"id":34545361,"file_name":"p_1.png","project_id":888002,"asset_id":771874,"created_at":"2024-11-16T17:26:14.198+08:00","updated_at":"2024-11-16T17:26:14.198+08:00"},{"id":34545362,"file_name":"jumper_1.png","project_id":888002,"asset_id":771876,"created_at":"2024-11-16T17:26:14.199+08:00","updated_at":"2024-11-16T17:26:14.199+08:00"},{"id":34545363,"file_name":"reset_btn.png","project_id":888002,"asset_id":771877,"created_at":"2024-11-16T17:26:14.200+08:00","updated_at":"2024-11-16T17:26:14.200+08:00"},{"id":34545364,"file_name":"rules.png","project_id":888002,"asset_id":771878,"created_at":"2024-11-16T17:26:14.201+08:00","updated_at":"2024-11-16T17:26:14.201+08:00"},{"id":34545365,"file_name":"p_2.png","project_id":888002,"asset_id":771879,"created_at":"2024-11-16T17:26:14.202+08:00","updated_at":"2024-11-16T17:26:14.202+08:00"},{"id":34545366,"file_name":"p_3.png","project_id":888002,"asset_id":771880,"created_at":"2024-11-16T17:26:14.203+08:00","updated_at":"2024-11-16T17:26:14.203+08:00"},{"id":34545367,"file_name":"bg.png","project_id":888002,"asset_id":771881,"created_at":"2024-11-16T17:26:14.204+08:00","updated_at":"2024-11-16T17:26:14.204+08:00"},{"id":34545368,"file_name":"board.png","project_id":888002,"asset_id":771882,"created_at":"2024-11-16T17:26:14.205+08:00","updated_at":"2024-11-16T17:26:14.205+08:00"},{"id":34545369,"file_name":"pie_b.png","project_id":888002,"asset_id":771883,"created_at":"2024-11-16T17:26:14.206+08:00","updated_at":"2024-11-16T17:26:14.206+08:00"},{"id":34545370,"file_name":"star.png","project_id":888002,"asset_id":771884,"created_at":"2024-11-16T17:26:14.207+08:00","updated_at":"2024-11-16T17:26:14.207+08:00"},{"id":34545371,"file_name":"pie_r.png","project_id":888002,"asset_id":771885,"created_at":"2024-11-16T17:26:14.208+08:00","updated_at":"2024-11-16T17:26:14.208+08:00"},{"id":34545372,"file_name":"jumper_0.png","project_id":888002,"asset_id":771875,"created_at":"2024-11-16T17:26:14.209+08:00","updated_at":"2024-11-16T17:26:14.209+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦