{"id":230803,"student_id":10,"content":"setBackdrop(\"bg.png\");\nlet pitcher = createSprite(\"pitcher.png\");\nlet ball = createSprite(\"ball.png\");\nlet player = createSprite(\"p_0.png\", \"p_1.png\", \"p_2.png\");\nvar life = createSprite(\"life_0.png\",\"life_1.png\",\"life_2.png\",\"life_3.png\");\nvar level = 0;\nlet status = 0; // 0: 等待中 1: 投手準備 2: 飛出 3: 擊飛\nlet speed = 0;\nlet countdown = 0;\nlet text = '';\nlife.costumeId = 3;\nball.y = 200;\nplayer.y = 700;\npitcher.y = 200;\n\ncreateSound('bgm.ogg');\n\nfunction gameloop () {\n \n // print(`level: ${level} status: ${status} countdown: ${countdown}`)\n \n if (status != 1) print(text, 10, 10, 'red', 60);\n ball.scale = (ball.y / 900) * 1.2;\n \n print('level:' + level, 10, 70, 'red', 60);\n \n if (countdown \u003e 0) {\n countdown -= 1;\n if (countdown == 0) {\n pitcher.direction = 60;\n status = 2;\n ball.direction = 180 + Math.random()*60 - 30;\n }\n }\n \n if (status == 2) {\n ball.stepForward(speed);\n speed += 0.2;\n }\n \n if (status == 3) {\n ball.stepForward(speed);\n speed -= 0.2;\n }\n \n if (status == 3 \u0026\u0026 speed \u003c 1) {\n status = 0;\n }\n \n \n if (status != 3 \u0026\u0026 status != 0) {\n player.x = cursor.x;\n }\n \n if (ball.y \u003e 1000 \u0026\u0026 status == 2) {\n status = 0;\n life.costumeId -= 1;\n text = '揮棒落空';\n }\n \n if (life.costumeId \u003c= 0) {\n stop();\n text = '遊戲結束';\n }\n}\n\nfunction onclick () {\n \n if (status == 0) {\n countdown = 30 + Math.floor(Math.random() * 120);\n speed = 1 + level * 0.1;\n player.costumeId = 0;\n ball.moveTo(pitcher);\n pitcher.direction = 90;\n }\n \n if (status == 2 \u0026\u0026 player.costumeId == 0) {\n \n createSound('wave.mp3');\n player.costumeId = 2;\n if (player.touched(ball)) {\n ball.direction = (ball.x - player.x)*2;\n status = 3;\n speed *= 2;\n createSound('hit.mp3');\n if (ball.direction \u003c 45 \u0026\u0026 ball.direction \u003e -45) {\n text = '成功!';\n level += 1;\n } else {\n life.costumeId -= 1;\n text = '出界!';\n }\n }\n }\n}\n\non('click', onclick)\nforever(gameloop);\n","created_at":"2021-02-24T12:22:51.859+08:00","updated_at":"2024-06-05T14:56:16.430+08:00","name":"叩叮打棒球","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/230803/424c19f1a1c2e5e82c00d3cb68220a5d.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":230,"hashid":"vngsyrepd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4141855,"file_name":"level_10.png","project_id":230803,"asset_id":320196,"created_at":"2021-02-24T16:04:00.655+08:00","updated_at":"2021-02-24T16:04:00.655+08:00"},{"id":4141856,"file_name":"level_9.png","project_id":230803,"asset_id":320197,"created_at":"2021-02-24T16:04:00.657+08:00","updated_at":"2021-02-24T16:04:00.657+08:00"},{"id":4141865,"file_name":"level_0.png","project_id":230803,"asset_id":320206,"created_at":"2021-02-24T16:04:03.992+08:00","updated_at":"2021-02-24T16:04:03.992+08:00"},{"id":4141702,"file_name":"p_2.png","project_id":230803,"asset_id":320188,"created_at":"2021-02-24T14:21:08.944+08:00","updated_at":"2021-02-24T14:22:15.032+08:00"},{"id":4141703,"file_name":"p_0.png","project_id":230803,"asset_id":320189,"created_at":"2021-02-24T14:21:08.946+08:00","updated_at":"2021-02-24T14:22:19.347+08:00"},{"id":4141853,"file_name":"life_2.png","project_id":230803,"asset_id":320194,"created_at":"2021-02-24T16:03:59.781+08:00","updated_at":"2021-02-24T16:03:59.781+08:00"},{"id":4141854,"file_name":"life_3.png","project_id":230803,"asset_id":320195,"created_at":"2021-02-24T16:03:59.783+08:00","updated_at":"2021-02-24T16:03:59.783+08:00"},{"id":4141700,"file_name":"bg.png","project_id":230803,"asset_id":320186,"created_at":"2021-02-24T14:21:07.975+08:00","updated_at":"2021-02-24T14:21:07.975+08:00"},{"id":4141701,"file_name":"ball.png","project_id":230803,"asset_id":320187,"created_at":"2021-02-24T14:21:07.977+08:00","updated_at":"2021-02-24T14:21:07.977+08:00"},{"id":4141868,"file_name":"bgm.ogg","project_id":230803,"asset_id":320209,"created_at":"2021-02-24T16:26:12.412+08:00","updated_at":"2021-02-24T16:26:12.412+08:00"},{"id":4141712,"file_name":"pitcher.png","project_id":230803,"asset_id":320191,"created_at":"2021-02-24T14:48:19.802+08:00","updated_at":"2021-02-24T14:48:19.802+08:00"},{"id":4141851,"file_name":"life_0.png","project_id":230803,"asset_id":320192,"created_at":"2021-02-24T16:03:58.958+08:00","updated_at":"2021-02-24T16:03:58.958+08:00"},{"id":4141852,"file_name":"life_1.png","project_id":230803,"asset_id":320193,"created_at":"2021-02-24T16:03:58.959+08:00","updated_at":"2021-02-24T16:03:58.959+08:00"},{"id":4141863,"file_name":"level_2.png","project_id":230803,"asset_id":320204,"created_at":"2021-02-24T16:04:03.539+08:00","updated_at":"2021-02-24T16:04:03.539+08:00"},{"id":4141864,"file_name":"level_1.png","project_id":230803,"asset_id":320205,"created_at":"2021-02-24T16:04:03.540+08:00","updated_at":"2021-02-24T16:04:03.540+08:00"},{"id":4141704,"file_name":"p_1.png","project_id":230803,"asset_id":320190,"created_at":"2021-02-24T14:21:09.695+08:00","updated_at":"2021-02-24T14:22:27.612+08:00"},{"id":4141861,"file_name":"level_4.png","project_id":230803,"asset_id":320202,"created_at":"2021-02-24T16:04:02.914+08:00","updated_at":"2021-02-24T16:04:02.914+08:00"},{"id":4141862,"file_name":"level_3.png","project_id":230803,"asset_id":320203,"created_at":"2021-02-24T16:04:02.916+08:00","updated_at":"2021-02-24T16:04:02.916+08:00"},{"id":4141867,"file_name":"wave.mp3","project_id":230803,"asset_id":320208,"created_at":"2021-02-24T16:21:29.366+08:00","updated_at":"2021-02-24T16:21:29.366+08:00"},{"id":4141866,"file_name":"hit.mp3","project_id":230803,"asset_id":320207,"created_at":"2021-02-24T16:21:29.365+08:00","updated_at":"2021-02-24T16:21:34.146+08:00"},{"id":4141857,"file_name":"level_8.png","project_id":230803,"asset_id":320198,"created_at":"2021-02-24T16:04:01.445+08:00","updated_at":"2021-02-24T16:04:01.445+08:00"},{"id":4141858,"file_name":"level_7.png","project_id":230803,"asset_id":320199,"created_at":"2021-02-24T16:04:01.446+08:00","updated_at":"2021-02-24T16:04:01.446+08:00"},{"id":4141859,"file_name":"level_6.png","project_id":230803,"asset_id":320200,"created_at":"2021-02-24T16:04:02.116+08:00","updated_at":"2021-02-24T16:04:02.116+08:00"},{"id":4141860,"file_name":"level_5.png","project_id":230803,"asset_id":320201,"created_at":"2021-02-24T16:04:02.118+08:00","updated_at":"2021-02-24T16:04:02.118+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦