{"id":16097,"student_id":888,"content":"setBackdrop(\"bg.png\", 0, 0, 640, 480);\n\nvar fg = createSprite(\"fg.png\");\nfg.scale = 0.5;\nfg.y = 417;\nfg.layer = 1;\n\nsound.play('music.mp3', true);\n\nvar gameOverLogo = createSprite(\"gameover.png\");\ngameOverLogo.hidden = true;\ngameOverLogo.layer = 2;\ngameOverLogo.scale = .6;\n\nvar score = 0;\n\nvar monsters = [];\n\nfor (var i=0; i\u003c5; i++) {\n var monster = createSprite([\"monster1.png\",\"monster2.png\",\"monster3.png\",\"monster4.png\",\"monster5.png\"]);\n monster.x = 70 + 124*i;\n monster.y = 450;\n monster.scale = 0.7;\n monster.status = 0;\n monster.move = 4;\n monster.active = false;\n monster.index = i;\n\n monster.forever(function(){\n\n if (!this.active) return;\n\n if (this.status == 0 \u0026\u0026 Math.random() \u003c 0.0075) {\n this.y = 440;\n this.status = 1;\n this.move = 4;\n this.costumeId = Math.floor(Math.random()*5);\n if (this.index == 0) sound.play('spawn1.mp3');\n if (this.index == 1) sound.play('spawn2.mp3');\n if (this.index == 2) sound.play('spawn3.mp3');\n if (this.index == 3) sound.play('spawn4.mp3');\n if (this.index == 4) sound.play('spawn5.mp3');\n }\n\n if (this.status == 1) {\n this.y -= this.move;\n if (this.y \u003c 270) {\n this.move = -this.move;\n }\n if (this.y \u003e 450) {\n this.status = 0;\n }\n }\n\n if (this.status == 2) {\n this.y += 20;\n if (this.y \u003e 450) {\n this.status = 0;\n }\n }\n });\n\n monsters.push(monster);\n}\n\nwhen('click', function () {\n\n if (!monsters[0].active) return startGame();\n\n for (var i=0; i\u003cmonsters.length; i++) {\n if (monsters[i].touched(cursor)) {\n monsters[i].status = 2;\n var m = Math.floor((monsters[i].y - 270)/17);\n var point = 10 + (monsters[i].move \u003e 0 ? 1 : -1)*m;\n score += point;\n createText('+' + point, monsters[i].x - 20, monsters[i].y - 100);\n sound.play('score.mp3');\n return;\n }\n }\n\n createText('-10', cursor.x - 15, cursor.y - 15);\n score -= 10;\n sound.play('miss.mp3');\n\n\n});\n\nfunction startGame () {\n score = 0;\n for (var i=0; i\u003c5; i++) {\n monsters[i].y = 450;\n monsters[i].active = true;\n }\n setTimeout(function () {\n gameOverLogo.hidden = false;\n print(score, 10, 10, 'white', 30);\n stop();\n }, 45000);\n\n}\n\nvar texts = [];\nfunction createText (t, x, y) {\n texts.push({ t: t, x: x, y: y, life: 45 });\n}\n\nforever(function(){\n print(score, 10, 10, 'white', 30);\n for (var i=0; i\u003ctexts.length; i++) {\n print(texts[i].t, texts[i].x, texts[i].y, 'white', 30);\n texts[i].y -= 1.5;\n texts[i].life--;\n\n if (texts[i].life \u003c 0) {\n texts.splice(i, 1);\n }\n }\n if (!monsters[0].active) print('CLICK TO START', 140, 50, 'white', 45);\n});\n","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-10T04:01:57.084+08:00","name":"whackathing","language":"javascript","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/16097/18cf8fe69b99993bb85844f8ed31c743.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[10,1936],"is_featured":true,"views":1220,"hashid":"ej9s2mpr","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":332407,"file_name":"bg.png","project_id":16097,"asset_id":38972,"created_at":"2017-11-24T10:40:07.573+08:00","updated_at":"2017-11-24T10:40:07.573+08:00"},{"id":332408,"file_name":"fg.png","project_id":16097,"asset_id":38973,"created_at":"2017-11-24T10:40:10.671+08:00","updated_at":"2017-11-24T10:40:10.671+08:00"},{"id":332409,"file_name":"monster4.png","project_id":16097,"asset_id":38974,"created_at":"2017-11-24T10:40:22.249+08:00","updated_at":"2017-11-24T10:40:22.249+08:00"},{"id":332410,"file_name":"monster1.png","project_id":16097,"asset_id":38975,"created_at":"2017-11-24T10:40:22.253+08:00","updated_at":"2017-11-24T10:40:22.253+08:00"},{"id":332411,"file_name":"monster2.png","project_id":16097,"asset_id":38976,"created_at":"2017-11-24T10:40:22.470+08:00","updated_at":"2017-11-24T10:40:22.470+08:00"},{"id":332412,"file_name":"monster3.png","project_id":16097,"asset_id":38977,"created_at":"2017-11-24T10:40:22.473+08:00","updated_at":"2017-11-24T10:40:22.473+08:00"},{"id":332413,"file_name":"monster5.png","project_id":16097,"asset_id":38978,"created_at":"2017-11-24T10:40:22.683+08:00","updated_at":"2017-11-24T10:40:22.683+08:00"},{"id":332417,"file_name":"gameover.png","project_id":16097,"asset_id":38979,"created_at":"2017-11-24T11:29:46.615+08:00","updated_at":"2017-11-24T11:29:46.615+08:00"},{"id":332418,"file_name":"particle.png","project_id":16097,"asset_id":38980,"created_at":"2017-11-24T11:39:35.939+08:00","updated_at":"2017-11-24T11:39:35.939+08:00"},{"id":332419,"file_name":"miss.mp3","project_id":16097,"asset_id":38981,"created_at":"2017-11-24T11:45:04.494+08:00","updated_at":"2017-11-24T11:45:04.494+08:00"},{"id":332420,"file_name":"music.mp3","project_id":16097,"asset_id":38982,"created_at":"2017-11-24T11:45:04.497+08:00","updated_at":"2017-11-24T11:45:04.497+08:00"},{"id":332421,"file_name":"score.mp3","project_id":16097,"asset_id":38983,"created_at":"2017-11-24T11:45:04.710+08:00","updated_at":"2017-11-24T11:45:04.710+08:00"},{"id":332422,"file_name":"spawn1.mp3","project_id":16097,"asset_id":38984,"created_at":"2017-11-24T11:45:04.714+08:00","updated_at":"2017-11-24T11:45:04.714+08:00"},{"id":332423,"file_name":"spawn2.mp3","project_id":16097,"asset_id":38985,"created_at":"2017-11-24T11:45:04.904+08:00","updated_at":"2017-11-24T11:45:04.904+08:00"},{"id":332424,"file_name":"spawn3.mp3","project_id":16097,"asset_id":38986,"created_at":"2017-11-24T11:45:04.907+08:00","updated_at":"2017-11-24T11:45:04.907+08:00"},{"id":332425,"file_name":"spawn4.mp3","project_id":16097,"asset_id":38987,"created_at":"2017-11-24T11:45:05.089+08:00","updated_at":"2017-11-24T11:45:05.089+08:00"},{"id":332426,"file_name":"spawn5.mp3","project_id":16097,"asset_id":38988,"created_at":"2017-11-24T11:45:05.092+08:00","updated_at":"2017-11-24T11:45:05.092+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦