{"id":183378,"student_id":2589,"content":"","created_at":"2020-08-21T11:27:57.327+08:00","updated_at":"2020-08-21T11:29:11.050+08:00","name":"飛行訓練(試玩版)","language":"javascript","screenshot":{"url":null},"parent_id":136305,"plugin":"Game.set({width: 1200, height: 900})\n\nsetBackdrop('bg.png'); //設定背景\nvar ship = createSprite('player.png'); //飛船\nvar food = createSprite('food_0.png', 'food_1.png', 'food_2.png'); //目標物\nvar bars = createSprite('d0.png', 'd1.png', 'd2.png', 'd3.png', 'd4.png', 'd5.png', 'd6.png', 'd7.png'); //儀表板\nvar n1 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'); //百位數\nvar n2 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'); //十位數\nvar n3 = createSprite('0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'); //個位數\nvar gameoverText = createSprite('gameover.png');\n\nn1.moveTo(550, 50);\nn2.moveTo(600, 50);\nn3.moveTo(650, 50);\nbars.moveTo(600, 850);\nship.layer = 1; //角色移動到上層\ngameoverText.hidden = true;\n\nvar flames = []; //存放火焰角色\nvar bullets = []; //存放子彈角色\nvar score = 0; //遊戲等級\nvar clock = 0; //計數器\nvar life = 7; //遊戲生命\nvar endTime = 0; //緩慢模式結束時間點\n\nfood.x = 100 + Math.random() * 1000;\nfood.y = 100 + Math.random() * 700;\n\ncreateSound('bgm.mp3', true);\n\nforever(loop); //重複不斷執行遊戲回圈\n\n//遊戲主迴圈\nfunction loop () {\n\n var speed = ship.distanceTo(cursor)/20; //距離滑鼠越遠速度越快\n ship.toward(cursor); //飛船朝向滑鼠\n ship.stepForward(speed);\n \n //緩速模式時子彈產生的速度變 1/4\n if (clock \u003c endTime) {\n rate = 8;\n } else {\n rate = 2;\n }\n\n clock++;\n if (clock % rate == 0) {\n var bullet = createSprite('bullet_0.png', 'bullet_1.png');\n bullet.direction = Math.random()*360;\n bullet.stepForward(1200);\n bullet.direction = Math.random()*360;\n bullets.push(bullet);\n }\n\n for (var i = 0; i \u003c bullets.length; i++) {\n var b = bullets[i];\n if (b.distanceTo(600, 450) \u003e 1200) {\n b.destroy();\n }\n if (b.touched(ship)) {\n b.destroy();\n life--;\n createSound('boom.wav');\n }\n if (clock \u003c endTime) {\n b.stepForward(1); //緩速模式時子彈速度變 1/4\n b.costumeId = 1;\n } else {\n b.stepForward(4);\n b.costumeId = 0;\n }\n }\n\n if (ship.touched(food)) {\n food.x = 100 + Math.random() * 1000;\n food.y = 100 + Math.random() * 700;\n \n //生命條造型編號不能超過 7\n if (food.costumeId == 1 \u0026\u0026 life \u003c 7) {\n life++;\n }\n if (food.costumeId == 2) {\n endTime = clock + 500; // 500 個遊戲迴圈的時間是緩速狀態\n }\n\n if (score % 10 == 4) { //每產生 10 個食物中第 5 個是緩速\n food.costumeId = 2;\n } else if (score % 10 == 9) { //每產生 10 個食物中第 9 個是補血\n food.costumeId = 1;\n } else {\n food.costumeId = 0;\n }\n score += 1;\n \n createSound('effect.wav');\n }\n\n n1.costumeId = Math.floor(score/100)%10; //分數百位數\n n2.costumeId = Math.floor(score/10)%10; //分數十位數\n n3.costumeId = Math.floor(score/1)%10; //分數個位數\n\n bars.costumeId = life; //生命值介於 0 - 7 之間\n if (life \u003c= 0) {\n stop();\n gameoverText.hidden = false;\n }\n\n if (clock % 5 == 0) {\n var flame = createSprite('flame.png');\n flame.direction = ship.direction + 90;\n flame.moveTo(ship);\n flames.push(flame);\n }\n \n for (var i = 0; i \u003c flames.length; i++) {\n flames[i].opacity -= 0.01;\n flames[i].scale -= 0.01;\n if (flames[i].opacity \u003c 0) {\n flames[i].destroy();\n }\n }\n}\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":71,"hashid":"jzmsg856","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3117991,"file_name":"boom.wav","project_id":183378,"asset_id":250885,"created_at":"2020-08-21T11:27:57.335+08:00","updated_at":"2020-08-21T11:27:57.335+08:00"},{"id":3117992,"file_name":"d0.png","project_id":183378,"asset_id":237098,"created_at":"2020-08-21T11:27:57.336+08:00","updated_at":"2020-08-21T11:27:57.336+08:00"},{"id":3117993,"file_name":"player.png","project_id":183378,"asset_id":204005,"created_at":"2020-08-21T11:27:57.338+08:00","updated_at":"2020-08-21T11:27:57.338+08:00"},{"id":3117994,"file_name":"food_2.png","project_id":183378,"asset_id":204004,"created_at":"2020-08-21T11:27:57.339+08:00","updated_at":"2020-08-21T11:27:57.339+08:00"},{"id":3117995,"file_name":"food_1.png","project_id":183378,"asset_id":204003,"created_at":"2020-08-21T11:27:57.340+08:00","updated_at":"2020-08-21T11:27:57.340+08:00"},{"id":3117996,"file_name":"food_0.png","project_id":183378,"asset_id":203712,"created_at":"2020-08-21T11:27:57.341+08:00","updated_at":"2020-08-21T11:27:57.341+08:00"},{"id":3117997,"file_name":"flame.png","project_id":183378,"asset_id":204002,"created_at":"2020-08-21T11:27:57.343+08:00","updated_at":"2020-08-21T11:27:57.343+08:00"},{"id":3117998,"file_name":"d7.png","project_id":183378,"asset_id":204001,"created_at":"2020-08-21T11:27:57.344+08:00","updated_at":"2020-08-21T11:27:57.344+08:00"},{"id":3117999,"file_name":"d6.png","project_id":183378,"asset_id":204000,"created_at":"2020-08-21T11:27:57.345+08:00","updated_at":"2020-08-21T11:27:57.345+08:00"},{"id":3118000,"file_name":"d5.png","project_id":183378,"asset_id":203999,"created_at":"2020-08-21T11:27:57.346+08:00","updated_at":"2020-08-21T11:27:57.346+08:00"},{"id":3118001,"file_name":"d4.png","project_id":183378,"asset_id":203998,"created_at":"2020-08-21T11:27:57.347+08:00","updated_at":"2020-08-21T11:27:57.347+08:00"},{"id":3118002,"file_name":"d3.png","project_id":183378,"asset_id":203997,"created_at":"2020-08-21T11:27:57.348+08:00","updated_at":"2020-08-21T11:27:57.348+08:00"},{"id":3118003,"file_name":"d2.png","project_id":183378,"asset_id":203996,"created_at":"2020-08-21T11:27:57.349+08:00","updated_at":"2020-08-21T11:27:57.349+08:00"},{"id":3118004,"file_name":"d1.png","project_id":183378,"asset_id":203995,"created_at":"2020-08-21T11:27:57.350+08:00","updated_at":"2020-08-21T11:27:57.350+08:00"},{"id":3118005,"file_name":"gameover.png","project_id":183378,"asset_id":203994,"created_at":"2020-08-21T11:27:57.351+08:00","updated_at":"2020-08-21T11:27:57.351+08:00"},{"id":3118006,"file_name":"bullet_1.png","project_id":183378,"asset_id":203993,"created_at":"2020-08-21T11:27:57.352+08:00","updated_at":"2020-08-21T11:27:57.352+08:00"},{"id":3118007,"file_name":"bullet_0.png","project_id":183378,"asset_id":203992,"created_at":"2020-08-21T11:27:57.353+08:00","updated_at":"2020-08-21T11:27:57.353+08:00"},{"id":3118008,"file_name":"bg.png","project_id":183378,"asset_id":203991,"created_at":"2020-08-21T11:27:57.354+08:00","updated_at":"2020-08-21T11:27:57.354+08:00"},{"id":3118009,"file_name":"9.png","project_id":183378,"asset_id":203990,"created_at":"2020-08-21T11:27:57.355+08:00","updated_at":"2020-08-21T11:27:57.355+08:00"},{"id":3118010,"file_name":"8.png","project_id":183378,"asset_id":203989,"created_at":"2020-08-21T11:27:57.356+08:00","updated_at":"2020-08-21T11:27:57.356+08:00"},{"id":3118011,"file_name":"7.png","project_id":183378,"asset_id":203988,"created_at":"2020-08-21T11:27:57.357+08:00","updated_at":"2020-08-21T11:27:57.357+08:00"},{"id":3118012,"file_name":"6.png","project_id":183378,"asset_id":203987,"created_at":"2020-08-21T11:27:57.358+08:00","updated_at":"2020-08-21T11:27:57.358+08:00"},{"id":3118013,"file_name":"5.png","project_id":183378,"asset_id":203986,"created_at":"2020-08-21T11:27:57.359+08:00","updated_at":"2020-08-21T11:27:57.359+08:00"},{"id":3118014,"file_name":"4.png","project_id":183378,"asset_id":203985,"created_at":"2020-08-21T11:27:57.360+08:00","updated_at":"2020-08-21T11:27:57.360+08:00"},{"id":3118015,"file_name":"3.png","project_id":183378,"asset_id":203984,"created_at":"2020-08-21T11:27:57.361+08:00","updated_at":"2020-08-21T11:27:57.361+08:00"},{"id":3118016,"file_name":"2.png","project_id":183378,"asset_id":203983,"created_at":"2020-08-21T11:27:57.362+08:00","updated_at":"2020-08-21T11:27:57.362+08:00"},{"id":3118017,"file_name":"1.png","project_id":183378,"asset_id":203982,"created_at":"2020-08-21T11:27:57.363+08:00","updated_at":"2020-08-21T11:27:57.363+08:00"},{"id":3118018,"file_name":"0.png","project_id":183378,"asset_id":203981,"created_at":"2020-08-21T11:27:57.364+08:00","updated_at":"2020-08-21T11:27:57.364+08:00"},{"id":3118019,"file_name":"bgm.mp3","project_id":183378,"asset_id":172346,"created_at":"2020-08-21T11:27:57.365+08:00","updated_at":"2020-08-21T11:27:57.365+08:00"},{"id":3118020,"file_name":"effect.wav","project_id":183378,"asset_id":172347,"created_at":"2020-08-21T11:27:57.367+08:00","updated_at":"2020-08-21T11:27:57.367+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦