{"id":326069,"student_id":10,"content":"setBackdrop(\"bg.png\");\nlet player = createSprite('r_0.png', 'r_1.png', 'r_2.png', 'r_3.png');\nlet myBall = createSprite('ball.png');\nlet levels = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png', '10.png', '11.png', '12.png');\nlet result = createSprite('r0.png', 'r1.png', 'r2.png', 'r3.png', 'r4.png', 'r5.png', 'r6.png', 'r7.png', 'r8.png', 'r9.png', 'r10.png', 'r11.png', 'r12.png');\nlet enemies = [];\nlet timer = [];\nlet balls = [];\nlet life = 3;\nlet level = 0;\nmyBall.scale = 0.5;\nplayer.scale = 0.75;\n\nplayer.x += 1300;\nresult.hidden = true;\n\nplayer.layer = 2;\nlevels.layer = 3;\nresult.layer = 4;\n\nfor (let i = 0; i \u003c 50; i++) {\n let e = createSprite(\"g_0.png\", \"g_1.png\", \"g_2.png\", \"g_3.png\", \"g_4.png\", \"g_5.png\", \"g_6.png\", \"g_7.png\");\n e.rotationStyle = 'fixed';\n e.scale = 0.75;\n e.x += 1300;\n enemies.push(e);\n}\n\nlevels.on('click', reset);\n\nfunction reset () {\n level += 1;\n myBall.hidden = true;\n for (let i = 0; i \u003c 50; i++) {\n let e = enemies[i];\n e.x = Math.random() * 900;\n e.y = Math.random() * 900;\n e.costumeId = 0;\n e.layer = 0;\n e.direction = Math.floor(Math.random() * 4) * 90 + 45;\n timer[i] = Math.floor(Math.random() * 200) + 180;\n e.hidden = i \u003e= level * 3;\n\n if (e.x + e.y \u003e 900) {\n let diff = e.x + e.y - 900;\n e.move(-diff, -diff);\n }\n }\n levels.hidden = true;\n}\n\nfunction gameloop () {\n if (levels.hidden \u0026\u0026 result.hidden) {\n updatePlayer();\n updateMyBall();\n enemies.forEach(updateEnemy);\n balls.forEach(updateBall);\n checkIsGameover();\n }\n if (levels.y \u003c 450) levels.y += 30;\n if (result.y \u003c 450) result.y += 30;\n}\n\nfunction updateMyBall () {\n if (cursor.isDown) {\n myBall.moveTo(player);\n myBall.hidden = false;\n }\n player.costumeId = cursor.isDown ? 1 : 0;\n\n if (cursor.isDown == false) {\n myBall.move(-20, -20);\n }\n}\n\nfunction updateEnemy (e, index) {\n\n timer[index] -= 1;\n let t = timer[index];\n\n if (e.costumeId == 7) {\n t = -1;\n }\n if (t \u003e 180) {\n e.stepForward(3);\n e.costumeId = Math.floor((e.x + e.y) / 50) % 2;\n }\n if (t == 180) {\n e.costumeId = 2;\n }\n if (t == 120) {\n e.costumeId = 3;\n }\n if (t == 60 \u0026\u0026 e.hidden == false) {\n e.costumeId = 4;\n createBall(e.x, e.y);\n }\n if (t == 0) {\n timer[index] = Math.floor(Math.random() * 200) + 180;\n e.costumeId = 0;\n e.direction = Math.floor(Math.random() * 4) * 90 + 45;\n }\n\n if (e.x \u003c 50) e.x = 50;\n if (e.y \u003c 50) e.y = 50;\n if (e.x + e.y \u003e 900) {\n let diff = e.x + e.y - 900;\n e.move(-diff / 2, -diff / 2);\n }\n\n if (e.touched(myBall) \u0026\u0026 e.costumeId != 7) {\n e.costumeId = 7;\n e.layer = -1;\n myBall.hidden = true;\n }\n}\n\nfunction updatePlayer () {\n player.moveTo(cursor);\n if (cursor.x + cursor.y \u003c 1200 \u0026\u0026 player) {\n let diff = 1200 - cursor.x - cursor.y;\n player.x += diff / 2;\n player.y += diff / 2;\n }\n}\n\nfunction updateBall (b) {\n b.x += 10;\n b.y += 10;\n if (b.x \u003e 1200 || b.y \u003e 900) {\n b.destroy();\n }\n if (b.touched(player)) {\n player.costumeId = 3;\n result.hidden = false;\n result.costumeId = levels.costumeId;\n result.y = -450;\n }\n}\n\nfunction createBall (x, y) {\n let ball = createSprite('ball.png');\n ball.x = x;\n ball.y = y;\n ball.scale = 0.5;\n balls.push(ball);\n}\n\nfunction checkIsGameover () {\n let count = 0;\n for (let i = 0; i \u003c 50; i++) {\n if (enemies[i].hidden || enemies[i].costumeId == 7) {\n count += 1;\n }\n }\n if (count == 50) {\n levels.costumeId = level;\n levels.hidden = false;\n levels.y = -450;\n }\n print(count);\n}\n\nforever(gameloop);","created_at":"2021-12-14T11:30:07.768+08:00","updated_at":"2021-12-20T15:31:25.756+08:00","name":"雪球大戰(簡易版)","language":"javascript","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/326069/b230fa3bcc0fafe3f75ee57f07ce202f.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":182,"hashid":"kdms6py9j","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6942481,"file_name":"r_3.png","project_id":326069,"asset_id":453523,"created_at":"2021-12-20T12:41:11.485+08:00","updated_at":"2021-12-20T12:41:11.485+08:00"},{"id":6942482,"file_name":"r0.png","project_id":326069,"asset_id":453524,"created_at":"2021-12-20T12:41:11.487+08:00","updated_at":"2021-12-20T12:41:11.487+08:00"},{"id":6942471,"file_name":"g_1.png","project_id":326069,"asset_id":453513,"created_at":"2021-12-20T12:41:08.252+08:00","updated_at":"2021-12-20T12:41:08.252+08:00"},{"id":6942472,"file_name":"g_2.png","project_id":326069,"asset_id":453514,"created_at":"2021-12-20T12:41:08.254+08:00","updated_at":"2021-12-20T12:41:08.254+08:00"},{"id":6942483,"file_name":"r1.png","project_id":326069,"asset_id":453525,"created_at":"2021-12-20T12:41:12.397+08:00","updated_at":"2021-12-20T12:41:12.397+08:00"},{"id":6942484,"file_name":"r2.png","project_id":326069,"asset_id":453526,"created_at":"2021-12-20T12:41:12.398+08:00","updated_at":"2021-12-20T12:41:12.398+08:00"},{"id":6942457,"file_name":"2.png","project_id":326069,"asset_id":453499,"created_at":"2021-12-20T12:41:03.031+08:00","updated_at":"2021-12-20T12:41:03.031+08:00"},{"id":6942458,"file_name":"3.png","project_id":326069,"asset_id":453500,"created_at":"2021-12-20T12:41:03.033+08:00","updated_at":"2021-12-20T12:41:03.033+08:00"},{"id":6942459,"file_name":"4.png","project_id":326069,"asset_id":453501,"created_at":"2021-12-20T12:41:03.949+08:00","updated_at":"2021-12-20T12:41:03.949+08:00"},{"id":6942460,"file_name":"5.png","project_id":326069,"asset_id":453502,"created_at":"2021-12-20T12:41:03.950+08:00","updated_at":"2021-12-20T12:41:03.950+08:00"},{"id":6942461,"file_name":"6.png","project_id":326069,"asset_id":453503,"created_at":"2021-12-20T12:41:04.852+08:00","updated_at":"2021-12-20T12:41:04.852+08:00"},{"id":6942462,"file_name":"7.png","project_id":326069,"asset_id":453504,"created_at":"2021-12-20T12:41:04.854+08:00","updated_at":"2021-12-20T12:41:04.854+08:00"},{"id":6942475,"file_name":"g_5.png","project_id":326069,"asset_id":453517,"created_at":"2021-12-20T12:41:09.454+08:00","updated_at":"2021-12-20T12:41:09.454+08:00"},{"id":6942476,"file_name":"g_6.png","project_id":326069,"asset_id":453518,"created_at":"2021-12-20T12:41:09.455+08:00","updated_at":"2021-12-20T12:41:09.455+08:00"},{"id":6942487,"file_name":"r5.png","project_id":326069,"asset_id":453529,"created_at":"2021-12-20T12:41:13.894+08:00","updated_at":"2021-12-20T12:41:13.894+08:00"},{"id":6942488,"file_name":"r6.png","project_id":326069,"asset_id":453530,"created_at":"2021-12-20T12:41:13.895+08:00","updated_at":"2021-12-20T12:41:13.895+08:00"},{"id":6942489,"file_name":"r7.png","project_id":326069,"asset_id":453531,"created_at":"2021-12-20T12:41:14.796+08:00","updated_at":"2021-12-20T12:41:14.796+08:00"},{"id":6942490,"file_name":"r8.png","project_id":326069,"asset_id":453532,"created_at":"2021-12-20T12:41:14.797+08:00","updated_at":"2021-12-20T12:41:14.797+08:00"},{"id":6942473,"file_name":"g_3.png","project_id":326069,"asset_id":453515,"created_at":"2021-12-20T12:41:08.852+08:00","updated_at":"2021-12-20T12:41:08.852+08:00"},{"id":6942474,"file_name":"g_4.png","project_id":326069,"asset_id":453516,"created_at":"2021-12-20T12:41:08.853+08:00","updated_at":"2021-12-20T12:41:08.853+08:00"},{"id":6942455,"file_name":"0.png","project_id":326069,"asset_id":453497,"created_at":"2021-12-20T12:41:01.522+08:00","updated_at":"2021-12-20T12:41:01.522+08:00"},{"id":6942456,"file_name":"1.png","project_id":326069,"asset_id":453498,"created_at":"2021-12-20T12:41:01.524+08:00","updated_at":"2021-12-20T12:41:01.524+08:00"},{"id":6942463,"file_name":"8.png","project_id":326069,"asset_id":453505,"created_at":"2021-12-20T12:41:05.481+08:00","updated_at":"2021-12-20T12:41:05.481+08:00"},{"id":6942464,"file_name":"9.png","project_id":326069,"asset_id":453506,"created_at":"2021-12-20T12:41:05.483+08:00","updated_at":"2021-12-20T12:41:05.483+08:00"},{"id":6942477,"file_name":"g_7.png","project_id":326069,"asset_id":453519,"created_at":"2021-12-20T12:41:10.139+08:00","updated_at":"2021-12-20T12:41:10.139+08:00"},{"id":6942478,"file_name":"r_0.png","project_id":326069,"asset_id":453520,"created_at":"2021-12-20T12:41:10.141+08:00","updated_at":"2021-12-20T12:41:10.141+08:00"},{"id":6942465,"file_name":"10.png","project_id":326069,"asset_id":453507,"created_at":"2021-12-20T12:41:06.382+08:00","updated_at":"2021-12-20T12:41:06.382+08:00"},{"id":6942466,"file_name":"11.png","project_id":326069,"asset_id":453508,"created_at":"2021-12-20T12:41:06.384+08:00","updated_at":"2021-12-20T12:41:06.384+08:00"},{"id":6942467,"file_name":"12.png","project_id":326069,"asset_id":453509,"created_at":"2021-12-20T12:41:07.114+08:00","updated_at":"2021-12-20T12:41:07.114+08:00"},{"id":6942468,"file_name":"ball.png","project_id":326069,"asset_id":453510,"created_at":"2021-12-20T12:41:07.115+08:00","updated_at":"2021-12-20T12:41:07.115+08:00"},{"id":6942493,"file_name":"r11.png","project_id":326069,"asset_id":453535,"created_at":"2021-12-20T12:41:16.280+08:00","updated_at":"2021-12-20T12:41:16.280+08:00"},{"id":6942494,"file_name":"r12.png","project_id":326069,"asset_id":453536,"created_at":"2021-12-20T12:41:16.282+08:00","updated_at":"2021-12-20T12:41:16.282+08:00"},{"id":6942491,"file_name":"r9.png","project_id":326069,"asset_id":453533,"created_at":"2021-12-20T12:41:15.481+08:00","updated_at":"2021-12-20T12:41:15.481+08:00"},{"id":6942492,"file_name":"r10.png","project_id":326069,"asset_id":453534,"created_at":"2021-12-20T12:41:15.482+08:00","updated_at":"2021-12-20T12:41:15.482+08:00"},{"id":6942469,"file_name":"bg.png","project_id":326069,"asset_id":453511,"created_at":"2021-12-20T12:41:07.695+08:00","updated_at":"2021-12-20T12:41:07.695+08:00"},{"id":6942470,"file_name":"g_0.png","project_id":326069,"asset_id":453512,"created_at":"2021-12-20T12:41:07.697+08:00","updated_at":"2021-12-20T12:41:07.697+08:00"},{"id":6942479,"file_name":"r_1.png","project_id":326069,"asset_id":453521,"created_at":"2021-12-20T12:41:10.700+08:00","updated_at":"2021-12-20T12:41:10.700+08:00"},{"id":6942480,"file_name":"r_2.png","project_id":326069,"asset_id":453522,"created_at":"2021-12-20T12:41:10.702+08:00","updated_at":"2021-12-20T12:41:10.702+08:00"},{"id":6942485,"file_name":"r3.png","project_id":326069,"asset_id":453527,"created_at":"2021-12-20T12:41:13.243+08:00","updated_at":"2021-12-20T12:41:13.243+08:00"},{"id":6942486,"file_name":"r4.png","project_id":326069,"asset_id":453528,"created_at":"2021-12-20T12:41:13.245+08:00","updated_at":"2021-12-20T12:41:13.245+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦