{"id":197160,"student_id":1806,"content":"import game\ngame.set_backdrop(\"bg.png\") #設定背景 s1\nball = game.create_sprite(\"ball.png\") #創造角色 s1+2\ninfo = game.create_sprite(\"info.png\") #創造角色 補1\nshadow = game.create_sprite(\"shadow.png\") #創造角色 補2\nvx = 0 #s3\nvy = 0 #s3\nscore = 0 #s7\nbest = 0 #s8\n\ngame.create_sound(\"bgm.mp3\", True) #補3\n\ndef loop(): #s2\n global vx, vy , score , best #s4若是外來變數要加上\n ball.x = ball.x + vx #s2+3\n ball.y = ball.y + vy #s2+3\n vy = vy + 0.33 #s5\n \n if ball.x \u003c 100 and vx \u003c 0: vx = -vx #s4左邊\n \n if ball.x \u003e 1100 and vx \u003e 0: vx = -vx #s4右邊\n \n if ball.y \u003c 100 and vy \u003c0: vy = -vy #s4上邊\n \n if ball.y \u003e 750 and vy \u003e0: #s4下邊\n vy = -vy * 0.7 #s5\n vx = vx * 0.7 #s5\n score = score - 5 #s7\n if score \u003c 0:score = 0 #額外加\n if score \u003e best: best = score #s8\n game.create_sound(\"bounce.mp3\") #補3\n \n if ball.touched(cursor):\n vx = (ball.x - cursor.x) / 4 #s6\n vy = (ball.y - cursor.y) / 4 #s6\n score = score + 3 #s7\n \n if cursor.is_down: info.hidden = True #補1\n \n shadow.x = ball.x #補2\n shadow.y = 850 #補2\n shadow.scale = ball.y / 750 #補2\n \n game.draw_text(score, 110, 80, \"white\", 50) #s7\n game.draw_text(best, 1050, 80, \"white\", 50) #s8\n \ngame.forever(loop) #重複不斷執行 s2","created_at":"2020-10-23T11:26:35.161+08:00","updated_at":"2023-04-25T13:56:26.183+08:00","name":"排球之王_dong","language":"python","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/197160/f6ad2e02ee834c503004ac0cc7322e30.jpg"},"parent_id":194469,"plugin":"","description":"點擊開始遊戲後排球會自然掉落\n玩家需要將滑鼠靠近球\n碰觸球的上方會往下掉,碰觸球的下方會往上飛\n\"接到一次加3分,掉落一次扣5分\",直到0分為止\n螢幕上會記錄目前分數及最高分數。加油!","note":"有音效、陰影、開始說明。\n計分方式為\"接到一次加3分,掉落一次扣5分\",直到0分為止","status":"public","like_student_ids":[1806],"is_featured":false,"views":186,"hashid":"yeysvzyvn","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3381833,"file_name":"info.png","project_id":197160,"asset_id":267837,"created_at":"2020-10-23T11:26:35.165+08:00","updated_at":"2020-10-23T11:26:35.165+08:00"},{"id":3381834,"file_name":"shadow.png","project_id":197160,"asset_id":267836,"created_at":"2020-10-23T11:26:35.168+08:00","updated_at":"2020-10-23T11:26:35.168+08:00"},{"id":3381835,"file_name":"ball.png","project_id":197160,"asset_id":267835,"created_at":"2020-10-23T11:26:35.169+08:00","updated_at":"2020-10-23T11:26:35.169+08:00"},{"id":3381836,"file_name":"bg.png","project_id":197160,"asset_id":267834,"created_at":"2020-10-23T11:26:35.170+08:00","updated_at":"2020-10-23T11:26:35.170+08:00"},{"id":3381837,"file_name":"bounce.mp3","project_id":197160,"asset_id":267833,"created_at":"2020-10-23T11:26:35.171+08:00","updated_at":"2020-10-23T11:26:35.171+08:00"},{"id":3381838,"file_name":"bgm.mp3","project_id":197160,"asset_id":267832,"created_at":"2020-10-23T11:26:35.172+08:00","updated_at":"2020-10-23T11:26:35.172+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦