{"id":4726,"student_id":888,"content":"DB.variables.highscore = DB.variables.highscore || 0;\nDB.variables.highscoreUser = DB.variables.highscoreUser || \"\";\n\nsetBackdrop(\"#8becff\");\nvar plane = createSprite({costumes:[\"plane.png\",\"boom.png\"]});\nplane.direction = \nplane.scale = 0.3;\nplane.layer = 999;\nvar missiles = [];\nvar clouds = [];\nvar startTime = new Date();\n\nwhen(\"holding\", \"right\", function(){\n\tplane.direction += 3;\n});\nwhen(\"holding\", \"left\", function(){\n\tplane.direction -= 3;\n});\nplane.forever(function(){\n\tthis.stepForward(3);\n if(plane.touched(missiles)){\n plane.costumeId = 1;\n var score = ((new Date())-startTime)/1000;\n if(score\u003eDB.variables.highscore){\n DB.variables.set(\"highscore\", ((new Date())-startTime)/1000);\n DB.variables.set(\"highscoreUser\", USER_NAME);\n }\n setTimeout(function(){stop();},1000);\n }\n});\nfor(var i=0; i\u003c100; i++){\n\tvar cloud = createSprite(\"cloud.png\");\n cloud.scale = 0.2+Math.random()*0.2;\n cloud.x = Math.random()*6400-3200;\n cloud.y = Math.random()*4800-2400;\n clouds.push(cloud);\n}\n\nforever(function(){\n var i=0;\n for(i=0; i\u003cmissiles.length; i++){\n missiles[i].x = missiles[i].x-plane.x+320;\n missiles[i].y = missiles[i].y-plane.y+240;\n }\n for(i=0; i\u003cclouds.length; i++){\n clouds[i].x = clouds[i].x-plane.x+320;\n clouds[i].y = clouds[i].y-plane.y+240;\n }\n plane.x = 320;\n plane.y = 240;\n var now = new Date();\n print( (now-startTime)/1000 );\n print( DB.variables.highscore+\" (\"+DB.variables.highscoreUser+\")\", 20, 460 );\n});\n\nsetInterval(function(){\n missileX = Math.random()*960-160;\n missileY = Math.random()*720-120;\n if(missileX\u003e0\u0026\u0026missileX\u003c620\u0026\u0026missileY\u003e0\u0026\u0026missileY\u003c480){\n return;\n }\n var missile = createSprite({costumes:[\"missile.png\",\"boom.png\"]});\n missile.x = missileX;\n missile.y = missileY;\n missile.scale = 0.1;\n missile.fuel = 800;\n missile.forever(function(){\n var originalDirection = this.direction;\n this.toward(plane);\n if( Math.abs(this.direction - originalDirection) \u003c 180 ){\n if(this.direction \u003e originalDirection){\n this.direction = originalDirection+1;\n } else {\n this.direction = originalDirection-1;\n }\n } else {\n if(this.direction \u003e originalDirection){\n this.direction = originalDirection-1;\n } else {\n this.direction = originalDirection+1;\n }\n }\n this.stepForward(4);\n this.fuel--;\n if(this.touched(missiles)\u0026\u0026this.fuel\u003e3){\n this.fuel = 3;\n }\n if(this.fuel\u003c=3){\n this.costumeId = 1;\n }\n if(this.fuel\u003c=0){\n this.destroy(); \n }\n });\n missiles.push(missile);\n}, 1000);","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2020-09-25T21:07:39.082+08:00","name":"躲避飛彈.jsa","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/4726/b90d4d060fccdc8ae10d32e5ef453af9.jpg"},"parent_id":2,"plugin":"","description":"用左右鍵控制飛機左右轉向,甩掉不斷追擊的飛彈吧!","note":null,"status":"public","like_student_ids":[149,1924,2010,1933,1934,2002,1936,1874,1935,109,3693,12205],"is_featured":true,"views":2950,"hashid":"ej9spm2","is_content_changed":null,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":129056,"file_name":"boom.png","project_id":4726,"asset_id":15706,"created_at":"2017-05-15T15:41:59.463+08:00","updated_at":"2017-05-15T15:41:59.463+08:00"},{"id":129057,"file_name":"cloud.png","project_id":4726,"asset_id":15707,"created_at":"2017-05-15T15:41:59.464+08:00","updated_at":"2017-05-15T15:41:59.464+08:00"},{"id":150606,"file_name":"plane.png","project_id":4726,"asset_id":17929,"created_at":"2017-06-16T11:11:58.430+08:00","updated_at":"2017-06-16T11:11:58.430+08:00"},{"id":150607,"file_name":"missile.png","project_id":4726,"asset_id":17930,"created_at":"2017-06-16T11:12:03.448+08:00","updated_at":"2017-06-16T11:12:03.448+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦