{"id":430985,"student_id":2589,"content":"function setAttribute(sprite, obj) {\n for (const [key, value] of Object.entries(obj)) {\n sprite[key] = value\n }\n}\n\ncreateSprite({ costumes: ['Kitchen.png'], hidden: false, scale: 0.25 });\ncreateSprite({ costumes: ['table_1.png'], hidden: false, scale: 0.25, x: 450, y: 835, layer: 8 });\ncreateSprite({ costumes: ['table_2.png'], hidden: false, scale: 0.25, x: 450, y: 680, layer: 6 });\ncreateSprite({ costumes: ['table_3.png'], hidden: false, scale: 0.25, x: 450, y: 510, layer: 4 });\ncreateSprite({ costumes: ['table_4.png'], hidden: false, scale: 0.25, x: 450, y: 340, layer: 2 });\ncreateSprite({ costumes: ['table_red.png'], hidden: false, scale: 0.25, x: 1132, y: 520 });\n\nlet instructions = createSprite({\n costumes: ['instructions.png'], \n hidden: false, scale: 1, x: 600, y: 450, layer: 999\n})\n\nlet gameover = createSprite({\n costumes: ['gameover.png'], \n hidden: true, scale: 1.5, x: 600, y: 450, layer: 1000\n})\n\nlet koding = createSprite({\n costumes: [\"koding.png\", \"kodingWithFood.png\", \"kodingUpset.png\"], \n hidden: false, scale: 0.25, x: 950, y: 220, direction: 100, costumeId: 0\n})\n\n\nlet customers = [], beerMugs = [], backCustomers = [];\nlet clock, score, level;\nlet beerSpeed, customerSpeed, interval, intervalChangedVal, minIntervalVal;\nlet show = false;\nlet gameoverClock = 0\nlet gameStatus = \"\"\n\n\nfunction kodingGoDown() {\n if (gameStatus === \"play\" \u0026\u0026 koding.y \u003c 730) {\n koding.y += 170\n }\n}\n\nfunction kodingGoUp() {\n if (gameStatus === \"play\" \u0026\u0026 koding.y \u003e 220) {\n koding.y -= 170\n }\n}\n\nfunction kodingGetBeer() {\n if (gameStatus === \"play\") {\n koding.costumeId = 1\n }\n}\n\nfunction kodingSendBeer() {\n if (gameStatus === \"play\") {\n koding.costumeId = 0;\n createBeer(koding.y);\n sound.play(\"shoot.wav\");\n }\n}\n\n\nfunction createBeer(yloc) {\n let beer = createSprite([\"originalFood.png\", \"brokenFood.png\"]);\n setAttribute(beer, {\n scale: 0.2, x: 800, y: yloc + 5, layer: 10\n })\n beerMugs.push(beer);\n}\n\nfunction moveBeerMugs() {\n beerMugs.forEach(beer =\u003e {\n if (!beer.hidden) {\n beer.x -= 2 * beerSpeed;\n customers.forEach(customer =\u003e {\n if (beer.touched(customer)) {\n score += 1;\n beer.hidden = true;\n beer.destroy();\n customer.costumeId = 1;\n backCustomers.push(customer);\n }\n })\n }\n })\n}\n\nfunction createCustomer() {\n if (clock % interval == 0) {\n let customer = createSprite([\"customer.png\", \"customerWithFood.png\", \"customerAngry.png\"]);\n table = Math.ceil(Math.random()*4);\n setAttribute(customer, {\n costumeId: 0, scale: 0.22, x: 80, y: 50 + 170 * table, layer: 2 * table - 1\n })\n customers.push(customer);\n }\n}\n\nfunction moveCustomers() {\n customers.forEach(customer =\u003e {\n customer.x += customerSpeed;\n })\n backCustomers.forEach(backCustomer =\u003e {\n backCustomer.x -= 4 * customerSpeed;\n backCustomer.x \u003c 100 \u0026\u0026 backCustomer.destroy();\n })\n}\n\nfunction checkGameOver() {\n beerMugs.forEach(beer =\u003e {\n if (beer.x \u003c 100) {\n beer.costumeId = 1;\n sound.play(\"beerHit.mp3\");\n sound.stop();\n gameoverClock = clock\n gameStatus = \"gameover\"\n }\n })\n customers.forEach(customer =\u003e {\n if (customer.x \u003e 780) {\n customer.costumeId = 2;\n sound.stop();\n gameoverClock = clock\n gameStatus = \"gameover\"\n }\n })\n}\n\n\nwhen('keydown', 'up', kodingGoUp);\nwhen('keydown', 'down', kodingGoDown);\nwhen('keydown', 'space', kodingGetBeer);\nwhen('keyup', 'space', kodingSendBeer);\n\nwhen('keydown', 'a', function(){\n console.log(`gameStatus: ${gameStatus}, clock: ${clock}, gameoverClock: ${gameoverClock}, score: ${score}`)\n console.log(`beerMugs: ${beerMugs.length}, customers: ${customers.length}, backCustomers: ${backCustomers.length}`)\n});\n\nvar pen = Game.pen;\n\ngameStatus = \"beforeplay\"\n// 不停地執行...\nforever(function() {\n clock += 1;\n \n if(show){\n pen.drawText(\"等級:\", 15, 15, 'white', 25);\n pen.drawText(level, 105, 15, 'white', 25);\n pen.drawText(\"分數:\", 15, 45, 'white', 25);\n pen.drawText(score, 105, 45, 'white', 25);\n }\n \n if (\n gameStatus === \"beforeplay\" \u0026\u0026 key.enter\n \u0026\u0026 (gameoverClock === 0 || clock \u003e gameoverClock + 50)) \n {\n \n beerMugs.forEach(beer =\u003e beer.destroy())\n customers.forEach(customer =\u003e customer.destroy());\n backCustomers.forEach(backCustomer =\u003e backCustomer.destroy());\n beerMugs = [], customers = [], backCustomers = [];\n show = !show\n clock = 0, score = 0, level = 1;\n beerSpeed = 2, customerSpeed = 1.7, interval = 100, intervalChangedVal = -14, minIntervalVal = 30;\n instructions.hidden = true;\n koding.costumeId = 0\n sound.play(\"bgm.wav\", true)\n gameStatus = \"play\"\n } else if (gameStatus === \"play\") {\n createCustomer();\n moveCustomers();\n moveBeerMugs();\n checkGameOver();\n if (clock % 500 == 0) {\n customerSpeed += 0.2;\n beerSpeed += 0.2;\n level += 1;\n if (interval \u003e minIntervalVal) {\n interval += intervalChangedVal;\n }\n }\n } else if (gameStatus === \"gameover\") {\n sound.stop();\n sound.play(\"lose.wav\");\n koding.costumeId = 2;\n gameover.hidden = false;\n gameStatus = \"gameset\"\n } else if (\n gameStatus === \"gameset\" \u0026\u0026 key.q\n ) {\n show = !show\n sound.stop();\n instructions.hidden = false;\n gameover.hidden = true;\n gameStatus = \"beforeplay\"\n }\n});","created_at":"2022-08-30T16:48:08.467+08:00","updated_at":"2022-10-20T15:03:51.993+08:00","name":"送餐大作戰","language":"javascript","screenshot":{"url":null},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})\n\n\n","description":"橘蘋餐館來了一位重要客人「動物警探達克比」,\n孩子們,你可以協助服務員「叩叮」順利完成送餐任務嗎?\n\n請注意!\n如果沒有滿足動物警探達克比的肚子,他將複製更多分身,持續湧進餐館!\n隨著客人愈來愈多、速度也愈來愈快,如果漏送餐或多送餐,遊戲都將立即結束!\n【請利用電腦鍵盤「↑」、「↓」操控叩叮移動方向,點擊「空白鍵」送餐。】\n\n只要達到指定分數就有小獎品,歡迎大朋友小朋友前來挑戰!\n\n-----\n遊戲製作:橘子蘋果兒童程式學苑\n圖像授權:動物警探達克比圖像授權 ©2022親子天下股份有限公司","note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":461,"hashid":"vngs5n895","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":9779955,"file_name":"kitchen.png","project_id":430985,"asset_id":563361,"created_at":"2022-09-13T13:19:30.257+08:00","updated_at":"2022-09-13T13:19:30.257+08:00"},{"id":9779956,"file_name":"Kitchen.png","project_id":430985,"asset_id":563362,"created_at":"2022-09-13T13:19:30.262+08:00","updated_at":"2022-09-13T13:19:30.262+08:00"},{"id":9779957,"file_name":"instructions.png","project_id":430985,"asset_id":563363,"created_at":"2022-09-13T13:19:30.269+08:00","updated_at":"2022-09-13T13:19:30.269+08:00"},{"id":9779958,"file_name":"table_2.png","project_id":430985,"asset_id":563364,"created_at":"2022-09-13T13:19:30.278+08:00","updated_at":"2022-09-13T13:19:30.278+08:00"},{"id":9779959,"file_name":"table_3.png","project_id":430985,"asset_id":563365,"created_at":"2022-09-13T13:19:30.282+08:00","updated_at":"2022-09-13T13:19:30.282+08:00"},{"id":9779960,"file_name":"table_4.png","project_id":430985,"asset_id":563366,"created_at":"2022-09-13T13:19:30.292+08:00","updated_at":"2022-09-13T13:19:30.292+08:00"},{"id":9779961,"file_name":"bgm.mp3","project_id":430985,"asset_id":563367,"created_at":"2022-09-13T13:19:30.362+08:00","updated_at":"2022-09-13T13:19:30.362+08:00"},{"id":9779962,"file_name":"beerHit.mp3","project_id":430985,"asset_id":563368,"created_at":"2022-09-13T13:19:30.367+08:00","updated_at":"2022-09-13T13:19:30.367+08:00"},{"id":9779963,"file_name":"customer.png","project_id":430985,"asset_id":563369,"created_at":"2022-09-13T13:19:30.373+08:00","updated_at":"2022-09-13T13:19:30.373+08:00"},{"id":9779964,"file_name":"customerAngry.png","project_id":430985,"asset_id":563370,"created_at":"2022-09-13T13:19:30.415+08:00","updated_at":"2022-09-13T13:19:30.415+08:00"},{"id":9779965,"file_name":"customerWithFood.png","project_id":430985,"asset_id":563371,"created_at":"2022-09-13T13:19:30.420+08:00","updated_at":"2022-09-13T13:19:30.420+08:00"},{"id":9779966,"file_name":"koding.png","project_id":430985,"asset_id":563372,"created_at":"2022-09-13T13:19:30.425+08:00","updated_at":"2022-09-13T13:19:30.425+08:00"},{"id":9779967,"file_name":"kodingUpset.png","project_id":430985,"asset_id":563373,"created_at":"2022-09-13T13:19:30.429+08:00","updated_at":"2022-09-13T13:19:30.429+08:00"},{"id":9779968,"file_name":"table_1.png","project_id":430985,"asset_id":563374,"created_at":"2022-09-13T13:19:30.434+08:00","updated_at":"2022-09-13T13:19:30.434+08:00"},{"id":9779969,"file_name":"brokenFood.png","project_id":430985,"asset_id":563375,"created_at":"2022-09-13T13:19:30.438+08:00","updated_at":"2022-09-13T13:19:30.438+08:00"},{"id":9779970,"file_name":"originalFood.png","project_id":430985,"asset_id":563376,"created_at":"2022-09-13T13:19:30.442+08:00","updated_at":"2022-09-13T13:19:30.442+08:00"},{"id":9779971,"file_name":"table_red.png","project_id":430985,"asset_id":563377,"created_at":"2022-09-13T13:19:30.446+08:00","updated_at":"2022-09-13T13:19:30.446+08:00"},{"id":9779972,"file_name":"kodingWithFood.png","project_id":430985,"asset_id":563378,"created_at":"2022-09-13T13:19:30.454+08:00","updated_at":"2022-09-13T13:19:30.454+08:00"},{"id":9779973,"file_name":"shoot.wav","project_id":430985,"asset_id":563379,"created_at":"2022-09-13T13:19:30.463+08:00","updated_at":"2022-09-13T13:19:30.463+08:00"},{"id":9779974,"file_name":"bgm.wav","project_id":430985,"asset_id":563380,"created_at":"2022-09-13T13:19:30.571+08:00","updated_at":"2022-09-13T13:19:30.571+08:00"},{"id":9779975,"file_name":"lose.wav","project_id":430985,"asset_id":563381,"created_at":"2022-09-13T13:19:30.585+08:00","updated_at":"2022-09-13T13:19:30.585+08:00"},{"id":9779976,"file_name":"gameover.png","project_id":430985,"asset_id":563382,"created_at":"2022-09-13T13:19:30.591+08:00","updated_at":"2022-09-13T13:19:30.591+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦