{"id":1076117,"student_id":2589,"content":"import game\nimport random\n\ngame.set_backdrop('bg.jpg')\nball = game.create_sprite('ball_0.png', 'ball_1.png')\np1 = game.create_sprite('p1.png')\np2 = game.create_sprite('p2.png')\ninfo = game.create_sprite('info.png', 'bg_1.jpg', 'bg_2.jpg')\n\np1.x = 30\np2.x = 1170\n\nspeed = 10\np1_score = 0\np2_score = 0\n\ngame.create_sound('bgm.mp3', True)\n\n\ndef loop():\n global p1_score, p2_score, speed\n\n if game.key.w and p1.y \u003e 0:\n p1.y -= 20\n \n if game.key.s and p1.y \u003c 900:\n p1.y += 20\n \n if game.key.o and p2.y \u003e 0:\n p2.y -= 20\n \n if game.key.l and p2.y \u003c 900:\n p2.y += 20\n\n if info.hidden:\n ball.step_forward(speed)\n\n if ball.touched(p1) and ball.direction \u003e 180:\n ball.direction = ball.direction * -1 + random.randrange(0, 15)\n speed += 1\n game.create_sound('hit.mp3')\n\n if ball.touched(p2) and ball.direction \u003c 180:\n ball.direction = ball.direction * -1 + random.randrange(0, 15)\n speed += 1\n game.create_sound('hit.mp3')\n\n if ball.y \u003c 0 or ball.y \u003e 900:\n ball.direction = ball.direction * -1 + 180\n\n if ball.x \u003c 0:\n ball.move_to(600, 450)\n ball.direction = 90\n speed = 10\n p2_score += 1\n game.create_sound('lose.ogg')\n\n if ball.x \u003e 1200:\n ball.moveTo(600, 450)\n ball.direction = 270\n speed = 10\n p1_score += 1\n game.create_sound('lose.ogg')\n\n game.draw_text(p1_score, 30, 20, 'white', 80)\n game.draw_text(p2_score, 1140, 20, 'white', 80)\n\n if p1_score == 5:\n game.stop()\n info.hidden = False\n info.costume_id = 2\n\n if p2_score == 5:\n game.stop()\n info.hidden = False\n info.costume_id = 1\n\n if game.key.space:\n info.hidden = True\n\n\nforever(loop)\n","created_at":"2025-07-31T21:33:05.093+08:00","updated_at":"2025-07-31T21:33:20.160+08:00","name":"はずむボールバトル","language":"python","screenshot":{"url":null},"parent_id":1076115,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":26,"hashid":"jzmsrpz9m","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":40067375,"file_name":"bgm.mp3","project_id":1076117,"asset_id":172560,"created_at":"2025-07-31T21:33:05.100+08:00","updated_at":"2025-07-31T21:33:05.100+08:00"},{"id":40067376,"file_name":"lose.ogg","project_id":1076117,"asset_id":192734,"created_at":"2025-07-31T21:33:05.101+08:00","updated_at":"2025-07-31T21:33:05.101+08:00"},{"id":40067377,"file_name":"ball_1.png","project_id":1076117,"asset_id":198067,"created_at":"2025-07-31T21:33:05.102+08:00","updated_at":"2025-07-31T21:33:05.102+08:00"},{"id":40067378,"file_name":"ball_3.png","project_id":1076117,"asset_id":198068,"created_at":"2025-07-31T21:33:05.103+08:00","updated_at":"2025-07-31T21:33:05.103+08:00"},{"id":40067379,"file_name":"bg.jpg","project_id":1076117,"asset_id":197970,"created_at":"2025-07-31T21:33:05.104+08:00","updated_at":"2025-07-31T21:33:05.104+08:00"},{"id":40067380,"file_name":"bg_1.jpg","project_id":1076117,"asset_id":197995,"created_at":"2025-07-31T21:33:05.105+08:00","updated_at":"2025-07-31T21:33:05.105+08:00"},{"id":40067381,"file_name":"bg_2.jpg","project_id":1076117,"asset_id":197996,"created_at":"2025-07-31T21:33:05.106+08:00","updated_at":"2025-07-31T21:33:05.106+08:00"},{"id":40067382,"file_name":"info.png","project_id":1076117,"asset_id":832438,"created_at":"2025-07-31T21:33:05.107+08:00","updated_at":"2025-07-31T21:33:05.107+08:00"},{"id":40067383,"file_name":"p1.png","project_id":1076117,"asset_id":197969,"created_at":"2025-07-31T21:33:05.108+08:00","updated_at":"2025-07-31T21:33:05.108+08:00"},{"id":40067384,"file_name":"p2.png","project_id":1076117,"asset_id":197971,"created_at":"2025-07-31T21:33:05.109+08:00","updated_at":"2025-07-31T21:33:05.109+08:00"},{"id":40067385,"file_name":"hit.mp3","project_id":1076117,"asset_id":17858,"created_at":"2025-07-31T21:33:05.110+08:00","updated_at":"2025-07-31T21:33:05.110+08:00"},{"id":40067386,"file_name":"ball_0.png","project_id":1076117,"asset_id":197998,"created_at":"2025-07-31T21:33:05.111+08:00","updated_at":"2025-07-31T21:33:05.111+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦