{"id":696822,"student_id":10,"content":"\nGame.set({ width: 1600, height: 900 });\nwindow.dispatchEvent(new Event('resize'));\n\nlet bg = createSprite(\"bg.png\")\nlet tb = createSprite(\"table.png\")\nlet player = createSprite('p_0.png', 'p_1.png', 'p_2.png')\n\nlet prods = []\nlet targets = []\nlet imgs = []\n\nlet fake \nlet clock = 0\nlet speed = 3\nlet SPACE = 400\nlet rands = []\nlet countdown = -1\nlet count\n\nlet info = createSprite('start.png', 'win.png', 'gameover.png')\ninfo.layer = 1\n\nlet alertIcon = createSprite('alert.png');\nalertIcon.x += 660\nalertIcon.hidden = true\n\nlet bgm = createSound('bgm.mp3', true)\nbgm.setVolume(0.4)\n\nfor (let i = 0; i \u003c 11; i++) {\n imgs.push(i + '.png')\n}\n\nfor (let i = 0; i \u003c 12; i++) {\n rands.push(Math.floor(Math.random() * 11))\n}\nrands.sort()\n\nfor (let i = 0; i \u003c 10; i++) {\n let p1 = createSprite(imgs)\n let p2 = createSprite(imgs)\n p1.x = -i * SPACE - SPACE\n p2.x = -i * SPACE - SPACE\n p1.y = 100\n p2.y = 800\n p1.costumeId = Math.floor(Math.random() * 11)\n p2.costumeId = Math.floor(Math.random() * 11)\n prods.push(p1, p2)\n}\n\nfor (let i = 0; i \u003c 12; i++) {\n let t = createSprite(imgs)\n t.x = 740 + (i % 4) * 90\n t.y = 360 + Math.floor(i / 4) * 90\n t.costumeId = rands[i]\n t.opacity = 0.6\n t.scale = 0.7\n targets.push(t)\n}\n\nforever(function(){\n \n if (info.costumeId === 0 \u0026\u0026 !info.hidden) return\n \n clock++\n timer = Math.floor(clock / 60)\n \n bg.x += speed\n tb.x += speed\n if (bg.x \u003e 1600) {\n bg.x -= 1600\n tb.x -= 1600\n }\n \n count = targets.filter(item =\u003e item.opacity == 1).length\n if (count === 12 \u0026\u0026 info.hidden) {\n info.costumeId = 1\n gameover()\n }\n\n prods.forEach(p =\u003e {\n p.x += speed\n p.scale = Math.floor(clock / 30) % 2 === 0 ? 1.3 : 1\n if (p.x \u003e 2000) {\n p.x -= SPACE * 10\n p.hidden = false\n p.costumeId = Math.floor(Math.random() * 11)\n }\n \n if (p.touched(player)) {\n let find = targets.find(t =\u003e t.costumeId === p.costumeId \u0026\u0026 t.opacity != 1)\n if (find) {\n find.opacity = 1\n find.scale = 1.2\n p.hidden = true\n fake = 'center'\n createSound('coin.mp3')\n } else if (info.hidden) {\n info.costumeId = 2\n info.hidden = false\n speed = 0\n createSound('error.ogg')\n gameover()\n }\n }\n })\n \n alertIcon.hidden = countdown \u003c 0\n alertIcon.scale = Math.floor(clock / 30) % 2 === 0 ? 0.7 : 0.6\n \n if (info.hidden) {\n \n if (fake === 'up') {\n if (player.costumeId !== 1) createSound('extend.wav')\n player.costumeId = 1\n }\n else if (fake === 'down') {\n if (player.costumeId !== 2) createSound('extend.wav')\n player.costumeId = 2\n } else {\n player.costumeId = 0\n }\n \n if (countdown \u003e 0) {\n countdown -= 1\n }\n \n if (countdown \u003c 0 \u0026\u0026 Math.random() \u003c 0.005) {\n countdown = 60\n }\n \n let d = (prods[0].x + 400 * 20) % SPACE\n let ok = d \u003e 250 \u0026\u0026 d \u003c 300\n if (ok \u0026\u0026 countdown === 0) {\n fake = Math.random() \u003e 0.5 ? 'up' : 'down'\n countdown = -1\n }\n }\n})\n\nfunction gameover() {\n \n info.hidden = false\n}\n\ninfo.on('click', () =\u003e {\n if (info.costumeId === 0) {\n info.hidden = true \n } else {\n stop()\n window.top.postMessage({ event: 'SET_SCORE', data: { score: count * 10 } }, '*') \n }\n \n})\n\non('keydown', 'up', () =\u003e {\n fake = fake === 'down' ? 'center' : 'up'\n})\n\non('keydown', 'down', () =\u003e {\n fake = fake === 'up' ? 'center' : 'down'\n})\n\non('keydown', 'left', () =\u003e {\n if (info.hidden) speed += 1\n})\n\non('keydown', 'right', () =\u003e {\n if (info.hidden) speed -= 1\n})\n","created_at":"2024-02-19T22:08:44.736+08:00","updated_at":"2024-03-08T16:01:11.677+08:00","name":"注意!衝動消費的叩叮","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/696822/6266396b230fde5cc407e00b713b3023.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":58,"hashid":"wdkswnp5v","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":15613940,"file_name":"p_1.png","project_id":696822,"asset_id":722296,"created_at":"2024-02-23T15:27:49.028+08:00","updated_at":"2024-02-23T15:27:49.028+08:00"},{"id":15613941,"file_name":"p_2.png","project_id":696822,"asset_id":722297,"created_at":"2024-02-23T15:27:49.031+08:00","updated_at":"2024-02-23T15:27:49.031+08:00"},{"id":15613926,"file_name":"0.png","project_id":696822,"asset_id":722282,"created_at":"2024-02-23T15:27:47.075+08:00","updated_at":"2024-02-23T15:27:47.075+08:00"},{"id":15613927,"file_name":"1.png","project_id":696822,"asset_id":722283,"created_at":"2024-02-23T15:27:47.077+08:00","updated_at":"2024-02-23T15:27:47.077+08:00"},{"id":15613928,"file_name":"2.png","project_id":696822,"asset_id":722284,"created_at":"2024-02-23T15:27:47.241+08:00","updated_at":"2024-02-23T15:27:47.241+08:00"},{"id":15613929,"file_name":"3.png","project_id":696822,"asset_id":722285,"created_at":"2024-02-23T15:27:47.243+08:00","updated_at":"2024-02-23T15:27:47.243+08:00"},{"id":15613930,"file_name":"4.png","project_id":696822,"asset_id":722286,"created_at":"2024-02-23T15:27:47.427+08:00","updated_at":"2024-02-23T15:27:47.427+08:00"},{"id":15613931,"file_name":"5.png","project_id":696822,"asset_id":722287,"created_at":"2024-02-23T15:27:47.429+08:00","updated_at":"2024-02-23T15:27:47.429+08:00"},{"id":15613932,"file_name":"6.png","project_id":696822,"asset_id":722288,"created_at":"2024-02-23T15:27:47.591+08:00","updated_at":"2024-02-23T15:27:47.591+08:00"},{"id":15613933,"file_name":"7.png","project_id":696822,"asset_id":722289,"created_at":"2024-02-23T15:27:47.593+08:00","updated_at":"2024-02-23T15:27:47.593+08:00"},{"id":15613934,"file_name":"8.png","project_id":696822,"asset_id":722290,"created_at":"2024-02-23T15:27:47.748+08:00","updated_at":"2024-02-23T15:27:47.748+08:00"},{"id":15613935,"file_name":"9.png","project_id":696822,"asset_id":722291,"created_at":"2024-02-23T15:27:47.749+08:00","updated_at":"2024-02-23T15:27:47.749+08:00"},{"id":15613938,"file_name":"gameover.png","project_id":696822,"asset_id":722294,"created_at":"2024-02-23T15:27:48.845+08:00","updated_at":"2024-02-23T15:27:48.845+08:00"},{"id":15613939,"file_name":"p_0.png","project_id":696822,"asset_id":722295,"created_at":"2024-02-23T15:27:48.847+08:00","updated_at":"2024-02-23T15:27:48.847+08:00"},{"id":15613936,"file_name":"10.png","project_id":696822,"asset_id":722292,"created_at":"2024-02-23T15:27:48.432+08:00","updated_at":"2024-02-23T15:27:48.432+08:00"},{"id":15613937,"file_name":"bg.png","project_id":696822,"asset_id":722293,"created_at":"2024-02-23T15:27:48.434+08:00","updated_at":"2024-02-23T15:27:48.434+08:00"},{"id":15613942,"file_name":"table.png","project_id":696822,"asset_id":722298,"created_at":"2024-02-23T15:27:49.899+08:00","updated_at":"2024-02-23T15:27:49.899+08:00"},{"id":15613943,"file_name":"win.png","project_id":696822,"asset_id":722299,"created_at":"2024-02-23T15:27:49.901+08:00","updated_at":"2024-02-23T15:27:49.901+08:00"},{"id":15702234,"file_name":"bgm.mp3","project_id":696822,"asset_id":723473,"created_at":"2024-02-26T16:04:10.401+08:00","updated_at":"2024-02-26T16:04:10.401+08:00"},{"id":15702233,"file_name":"error.ogg","project_id":696822,"asset_id":723472,"created_at":"2024-02-26T16:00:03.608+08:00","updated_at":"2024-02-26T16:00:03.608+08:00"},{"id":15702207,"file_name":"extend.wav","project_id":696822,"asset_id":723471,"created_at":"2024-02-26T15:52:33.690+08:00","updated_at":"2024-02-26T15:52:33.690+08:00"},{"id":15702062,"file_name":"coin.mp3","project_id":696822,"asset_id":255906,"created_at":"2024-02-25T23:16:37.295+08:00","updated_at":"2024-02-25T23:16:37.295+08:00"},{"id":15702244,"file_name":"alert.png","project_id":696822,"asset_id":723477,"created_at":"2024-02-26T16:39:47.965+08:00","updated_at":"2024-02-26T16:39:47.965+08:00"},{"id":15702063,"file_name":"bomb.mp3","project_id":696822,"asset_id":318399,"created_at":"2024-02-25T23:16:37.297+08:00","updated_at":"2024-02-25T23:16:37.297+08:00"},{"id":15926449,"file_name":"start.png","project_id":696822,"asset_id":726545,"created_at":"2024-03-15T11:06:59.882+08:00","updated_at":"2024-03-15T11:06:59.882+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦