{"id":726118,"student_id":3760,"content":"import game #載入遊戲套件\n\ngame.set_backdrop('bg.png') #設定背景圖\nball = game.create_sprite('ball.png') #球\ninfo = game.create_sprite(\"info.png\") #遊戲說明\nshadow = game.create_sprite(\"shadow.png\") #球的影子\n\ninfo.hidden = False\n\nvx = 0\nvy = 0\nscore = 0\nbest = 0\n\n#遊戲迴圈\ndef loop ():\n global vx, vy, score, best\n \n ball.x = ball.x + vx\n ball.y = ball.y + vy\n \n vy = vy + 0.33\n \n if ball.x \u003c 100 and vx \u003c 0: \n vx = -vx\n if ball.x \u003e 1100 and vx \u003e 0: \n vx = -vx\n if ball.y \u003c 100 and vy \u003c 0:\n vy = -vy\n if ball.y \u003e 750 and vy \u003e 0: \n vy = -vy * 0.7\n vx = vx * 0.7\n score = 0\n \n if ball.touched(cursor):\n vx = (ball.x - cursor.x) / 4\n vy = (ball.y - cursor.y) / 4\n score = score + 1\n best = max(best, score)\n game.create_sound(\"bounce.mp3\")\n \n if cursor.is_down:\n info.hidden = True\n \n shadow.x = ball.x\n shadow.y = 850\n shadow.scale = ball.y / 750\n \n \n game.draw_text(score, 110, 80, 'white', 50)\n game.draw_text(best, 1050, 80, 'white', 50)\n\n\ngame.forever(loop) #重複不斷執行遊戲迴圈\ngame.create_sound('bgm.mp3', True)\n\n","created_at":"2024-04-06T00:36:07.898+08:00","updated_at":"2024-04-06T01:53:55.903+08:00","name":"排球之王(預設版) 副本","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/726118/e7b132f9e21dc57bc8c09b0e0d83562b.jpg"},"parent_id":194469,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":46,"hashid":"yeysgj23v","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16233033,"file_name":"bgm.mp3","project_id":726118,"asset_id":267832,"created_at":"2024-04-06T00:36:07.905+08:00","updated_at":"2024-04-06T00:36:07.905+08:00"},{"id":16233034,"file_name":"bounce.mp3","project_id":726118,"asset_id":267833,"created_at":"2024-04-06T00:36:07.906+08:00","updated_at":"2024-04-06T00:36:07.906+08:00"},{"id":16233035,"file_name":"bg.png","project_id":726118,"asset_id":267834,"created_at":"2024-04-06T00:36:07.908+08:00","updated_at":"2024-04-06T00:36:07.908+08:00"},{"id":16233036,"file_name":"ball.png","project_id":726118,"asset_id":267835,"created_at":"2024-04-06T00:36:07.909+08:00","updated_at":"2024-04-06T00:36:07.909+08:00"},{"id":16233037,"file_name":"shadow.png","project_id":726118,"asset_id":267836,"created_at":"2024-04-06T00:36:07.910+08:00","updated_at":"2024-04-06T00:36:07.910+08:00"},{"id":16233038,"file_name":"info.png","project_id":726118,"asset_id":267837,"created_at":"2024-04-06T00:36:07.912+08:00","updated_at":"2024-04-06T00:36:07.912+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦