{"id":9587,"student_id":7,"content":"setBackdrop(\"bg.png\", -20, 0,900, 480);\n\nvar settings = {\n minSpeed: 2,\n maxSpeed: 5,\n rotateSpeed: 0.8,\n ejectedSpeed: 8\n};\n\nvar currentArrow = null;\nvar currentDirection = 0;\nvar combo = 0;\nvar score = 0;\nvar kodings = [];\n\nfunction createKoding() {\n var koding = createSprite({\n y: 50,\n x: Math.random() * 640,\n scale: 0.3,\n costumes: [\"1.svg\", \"2.svg\"],\n });\n var direction = Math.floor(Math.random() * 2); // 起始方向\n var moveSpeed = settings.minSpeed + (settings.maxSpeed - settings.minSpeed) * Math.random();\n if (direction == 1) {\n moveSpeed *= -1;\n koding.costumeId = 1\n }\n\n koding.forever(function(){\n if (this.x \u003e 640 || this.x \u003c 0) {\n moveSpeed *= -1 // 改變方向\n if (this.costumeId === 1) {\n this.costumeId = 0;\n } else {\n this.costumeId = 1;\n }\n }\n this.x += moveSpeed;\n });\n\n return koding;\n}\n\nfunction reloadArrow() {\n var arrow = createSprite({\n y: 480,\n x: 320,\n scale: 1,\n direction: currentDirection,\n costumes: [\"arrow.png\"],\n });\n arrow.forever(function(){\n if(!this.ejected) {\n if (currentDirection \u003e= 45 || currentDirection \u003c= -45) {\n settings.rotateSpeed *= -1;\n }\n currentDirection += settings.rotateSpeed;\n this.direction = currentDirection;\n } else {\n this.stepForward(settings.ejectedSpeed);\n if(this.y \u003c -80) {\n this.destroy();\n combo = 0;\n }\n }\n });\n\n arrow.on('touch', kodings, function(koding){\n koding.destroy();\n this.destroy();\n kodings.push(createKoding())\n combo++;\n score += 100;\n });\n return arrow\n}\n\n// Initialize\nfor(var i = 0; i \u003c 5; i++) {\n kodings.push(createKoding());\n}\ncurrentArrow = reloadArrow();\n\nforever(function(){\n print(combo + ' Combos', 10, 460 - 20*combo, 'black', 20*combo);\n print('得分: '+ score, 500, 460);\n});\n\nwhen('click', function() {\n if (!currentArrow.ejected) {\n currentArrow.ejected = true;\n currentArrow = reloadArrow();\n }\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-11T15:28:17.587+08:00","name":"射擊叩叮","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/9587/879afbfa252e1177ad5d94706244d321.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[119,1934],"is_featured":false,"views":430,"hashid":"zpesjdve","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":210402,"file_name":"1.svg","project_id":9587,"asset_id":7,"created_at":"2017-08-19T11:16:35.734+08:00","updated_at":"2017-08-19T11:16:35.734+08:00"},{"id":210584,"file_name":"2.svg","project_id":9587,"asset_id":25342,"created_at":"2017-08-19T11:44:49.909+08:00","updated_at":"2017-08-19T11:44:49.909+08:00"},{"id":210910,"file_name":"bg.png","project_id":9587,"asset_id":25361,"created_at":"2017-08-19T12:18:00.680+08:00","updated_at":"2017-08-19T12:18:00.680+08:00"},{"id":213615,"file_name":"arrow.png","project_id":9587,"asset_id":25785,"created_at":"2017-08-19T15:46:40.663+08:00","updated_at":"2017-08-19T15:46:40.663+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦