{"id":863575,"student_id":1981,"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') #遊戲說明\n# create_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\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\n bg.y += vy\n jumper.x += vx\n jumper.y += vy\n vy -= gravity\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 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\non('keydown', 'space', start)\nforever(loop)\n","created_at":"2024-10-15T16:10:35.808+08:00","updated_at":"2024-10-15T16:10:35.808+08:00","name":"5_彈簧床高手_預設版 副本 副本","language":"python","screenshot":{"url":null},"parent_id":833891,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":3,"hashid":"gk4s8q589","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":18911584,"file_name":"bgm.mp3","project_id":863575,"asset_id":771871,"created_at":"2024-10-15T16:10:35.813+08:00","updated_at":"2024-10-15T16:10:35.813+08:00"},{"id":18911585,"file_name":"bell.mp3","project_id":863575,"asset_id":771872,"created_at":"2024-10-15T16:10:35.814+08:00","updated_at":"2024-10-15T16:10:35.814+08:00"},{"id":18911586,"file_name":"p_0.png","project_id":863575,"asset_id":771873,"created_at":"2024-10-15T16:10:35.815+08:00","updated_at":"2024-10-15T16:10:35.815+08:00"},{"id":18911587,"file_name":"p_1.png","project_id":863575,"asset_id":771874,"created_at":"2024-10-15T16:10:35.816+08:00","updated_at":"2024-10-15T16:10:35.816+08:00"},{"id":18911588,"file_name":"jumper_1.png","project_id":863575,"asset_id":771876,"created_at":"2024-10-15T16:10:35.817+08:00","updated_at":"2024-10-15T16:10:35.817+08:00"},{"id":18911589,"file_name":"reset_btn.png","project_id":863575,"asset_id":771877,"created_at":"2024-10-15T16:10:35.818+08:00","updated_at":"2024-10-15T16:10:35.818+08:00"},{"id":18911590,"file_name":"rules.png","project_id":863575,"asset_id":771878,"created_at":"2024-10-15T16:10:35.819+08:00","updated_at":"2024-10-15T16:10:35.819+08:00"},{"id":18911591,"file_name":"p_2.png","project_id":863575,"asset_id":771879,"created_at":"2024-10-15T16:10:35.820+08:00","updated_at":"2024-10-15T16:10:35.820+08:00"},{"id":18911592,"file_name":"p_3.png","project_id":863575,"asset_id":771880,"created_at":"2024-10-15T16:10:35.820+08:00","updated_at":"2024-10-15T16:10:35.820+08:00"},{"id":18911593,"file_name":"bg.png","project_id":863575,"asset_id":771881,"created_at":"2024-10-15T16:10:35.821+08:00","updated_at":"2024-10-15T16:10:35.821+08:00"},{"id":18911594,"file_name":"board.png","project_id":863575,"asset_id":771882,"created_at":"2024-10-15T16:10:35.822+08:00","updated_at":"2024-10-15T16:10:35.822+08:00"},{"id":18911595,"file_name":"pie_b.png","project_id":863575,"asset_id":771883,"created_at":"2024-10-15T16:10:35.823+08:00","updated_at":"2024-10-15T16:10:35.823+08:00"},{"id":18911596,"file_name":"star.png","project_id":863575,"asset_id":771884,"created_at":"2024-10-15T16:10:35.824+08:00","updated_at":"2024-10-15T16:10:35.824+08:00"},{"id":18911597,"file_name":"pie_r.png","project_id":863575,"asset_id":771885,"created_at":"2024-10-15T16:10:35.825+08:00","updated_at":"2024-10-15T16:10:35.825+08:00"},{"id":18911598,"file_name":"jumper_0.png","project_id":863575,"asset_id":771875,"created_at":"2024-10-15T16:10:35.825+08:00","updated_at":"2024-10-15T16:10:35.825+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦