{"id":189992,"student_id":10,"content":"import game #載入遊戲套件\n\ngame.set_backdrop('bg.png') #設定背景圖\nshadow = game.create_sprite('shadow.png') #球的影子\nball = game.create_sprite('ball.png') #球\ninfo = game.create_sprite('info.png') #遊戲說明\n\nvx = 10 #水平速度\nvy = 10 #垂直速度\nscore = 0 #當前得分\nbest = 0 #最佳分數\n\ngame.create_sound('bgm.mp3', True)\n\ndef loop ():\n global vx, vy, score, best\n \n #根據速度改變球的位置\n ball.x = ball.x + vx\n ball.y = ball.y + vy\n vy += 1/3 #模擬引力\n \n #當球超出左邊邊界\n if ball.x \u003c 100 and vx \u003c 0: vx = -vx\n \n #當球超出右邊邊界\n if ball.x \u003e 1100 and vx \u003e 0: vx = -vx\n \n #當球超出上方邊界\n if ball.y \u003c 100 and vy \u003c 0: vy = -vy\n \n #當球超出下方邊界\n if ball.y \u003e 800 and vy \u003e 0:\n vy = -vy * 0.7\n vx = vx * 0.7\n score = 0\n \n # #如果球碰撞到滑鼠\n if ball.touched(cursor) == True:\n vx = (ball.x - cursor.x) / 4\n vy = (ball.y - cursor.y) / 4\n score += 1\n if score \u003e best: best = score\n game.create_sound('bounce.mp3')\n \n #如果滑鼠按下就隱藏遊戲說明\n if cursor.is_down == True:\n info.hidden = True\n \n game.draw_text(score, 110, 80, 'white', 50)\n game.draw_text(best, 1050, 80, 'white', 50)\n ball.direction += vx/10 #根據水平速度旋轉球的方向\n \n shadow.x = ball.x #影子在球的正下方\n shadow.y = 850\n shadow.scale = ball.y / 500 #球越下面影子越大\n\ngame.forever(loop) #重複不斷執行\n","created_at":"2020-09-08T17:14:42.110+08:00","updated_at":"2024-07-11T10:34:56.150+08:00","name":"排球之王(完整版)","language":"python","screenshot":{"url":"/uploads/project/screenshot/189992/b94865c1561d63a47e104e4153343c2d.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":416,"hashid":"qmdszeq9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3237504,"file_name":"bg.png","project_id":189992,"asset_id":260478,"created_at":"2020-09-10T18:38:47.111+08:00","updated_at":"2020-09-10T18:38:47.111+08:00"},{"id":3237299,"file_name":"info.png","project_id":189992,"asset_id":260462,"created_at":"2020-09-10T17:34:39.015+08:00","updated_at":"2020-09-10T18:38:37.672+08:00"},{"id":3237480,"file_name":"ball.png","project_id":189992,"asset_id":260477,"created_at":"2020-09-10T18:33:20.999+08:00","updated_at":"2020-09-10T18:33:20.999+08:00"},{"id":3237301,"file_name":"shadow.png","project_id":189992,"asset_id":260464,"created_at":"2020-09-10T17:34:39.480+08:00","updated_at":"2020-09-10T17:34:39.480+08:00"},{"id":3272735,"file_name":"bounce.mp3","project_id":189992,"asset_id":262238,"created_at":"2020-09-14T12:34:08.042+08:00","updated_at":"2020-09-14T12:34:08.042+08:00"},{"id":3272736,"file_name":"bgm.mp3","project_id":189992,"asset_id":262227,"created_at":"2020-09-14T12:34:12.051+08:00","updated_at":"2020-09-14T12:34:12.051+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Screenshot
繁中
简中
English
日本語
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer