{"id":225410,"student_id":1844,"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\") #創造角色-球的影子\ngame.create_sound('bgm.mp3')\nheart1 = game.create_sprite(\"heart.png\")\nheart1.scale = 0.15\nheart2 = game.create_sprite(\"heart.png\")\nheart2.scale = 0.15\nheart3 = game.create_sprite(\"heart.png\")\nheart3.scale = 0.15\ngg = game.create_sprite(\"game over.png\")\ngg.scale = 4\n\n\nball.x = 600\nball.y = 450\nvx = 0\nvy = 0\nscore = 0\nbest = 0\nlife = 3\nheart1.x = 70\nheart1.y = 180\nheart2.x = 133\nheart2.y = 180\nheart3.x = 196\nheart3.y = 180\ngg.hidden = True\nstatus = False\n\n\n#遊戲主迴圈\ndef loop():\n global vx, vy, score, best, life, status\n \n vy += 0.33\n if cursor.is_down: \n info.hidden = True\n status = True\n \n if status == True:\n ball.x += vx\n ball.y += vy\n if ball.x \u003c 100 and vx \u003c 0: vx = -vx\n \n if ball.x \u003e 1100 and vx \u003e 0: vx = -vx\n \n if ball.y \u003c 100 and vy \u003c 0: vy = -vy\n \n if ball.y \u003e 750 and vy \u003e 0:\n vy = -vy * 0.7\n vx = vx * 0.7\n score = 0\n life -= 1\n if life == 2:\n heart3.hidden = True\n elif life == 1:\n heart3.hidden = True\n heart2.hidden = True\n \n if life == 0:\n heart1.hidden = True\n gg.hidden = False\n status = False\n \n if ball.touched(cursor):\n vx = (ball.x - cursor.x) / 4\n vy = (ball.y - cursor.y) / 4\n score += 1\n game.create_sound('bounce.mp3')\n \n if score \u003e best: best = score\n \n \n shadow.x = ball.x\n shadow.y = 850\n shadow.scale = ball.y / 750\n \n game.draw_text(score, 115, 76, \"white\", 50)\n game.draw_text(best, 1050, 76, \"white\", 50)\n\n\ngame.forever(loop)\n\n\n\n","created_at":"2021-01-30T16:08:56.210+08:00","updated_at":"2022-01-23T14:01:56.268+08:00","name":"排球之王(預設版) 副本","language":"python","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/225410/0f5c93f42b16266ed122614bfc672338.jpg"},"parent_id":194469,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":19,"hashid":"6rps9q324","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4019838,"file_name":"bgm.mp3","project_id":225410,"asset_id":267832,"created_at":"2021-01-30T16:08:56.216+08:00","updated_at":"2021-01-30T16:08:56.216+08:00"},{"id":4019839,"file_name":"bounce.mp3","project_id":225410,"asset_id":267833,"created_at":"2021-01-30T16:08:56.217+08:00","updated_at":"2021-01-30T16:08:56.217+08:00"},{"id":4019840,"file_name":"bg.png","project_id":225410,"asset_id":267834,"created_at":"2021-01-30T16:08:56.218+08:00","updated_at":"2021-01-30T16:08:56.218+08:00"},{"id":4019841,"file_name":"ball.png","project_id":225410,"asset_id":267835,"created_at":"2021-01-30T16:08:56.220+08:00","updated_at":"2021-01-30T16:08:56.220+08:00"},{"id":4019842,"file_name":"shadow.png","project_id":225410,"asset_id":267836,"created_at":"2021-01-30T16:08:56.221+08:00","updated_at":"2021-01-30T16:08:56.221+08:00"},{"id":4019843,"file_name":"info.png","project_id":225410,"asset_id":267837,"created_at":"2021-01-30T16:08:56.222+08:00","updated_at":"2021-01-30T16:08:56.222+08:00"},{"id":4021827,"file_name":"heart.png","project_id":225410,"asset_id":313549,"created_at":"2021-01-30T17:23:03.966+08:00","updated_at":"2021-01-30T17:23:03.966+08:00"},{"id":4022161,"file_name":"game over.png","project_id":225410,"asset_id":313597,"created_at":"2021-01-30T17:36:32.071+08:00","updated_at":"2021-01-30T17:36:32.071+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦