{"id":136305,"student_id":10,"content":"setBackdrop('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","created_at":"2020-03-24T10:55:36.113+08:00","updated_at":"2021-11-15T18:44:05.368+08:00","name":"飛行訓練(完整版)","language":"javascript","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/136305/9a2602154c461dab9ff9c73cf51c9a62.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":266,"hashid":"5j3swm9m","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2344336,"file_name":"effect.wav","project_id":136305,"asset_id":172347,"created_at":"2020-03-24T11:03:03.712+08:00","updated_at":"2020-03-24T11:03:03.712+08:00"},{"id":2344337,"file_name":"bgm.mp3","project_id":136305,"asset_id":172346,"created_at":"2020-03-24T11:03:08.627+08:00","updated_at":"2020-03-24T11:03:08.627+08:00"},{"id":2390297,"file_name":"6.png","project_id":136305,"asset_id":203987,"created_at":"2020-04-10T10:22:51.465+08:00","updated_at":"2020-04-10T10:22:51.465+08:00"},{"id":2390298,"file_name":"7.png","project_id":136305,"asset_id":203988,"created_at":"2020-04-10T10:22:51.466+08:00","updated_at":"2020-04-10T10:22:51.466+08:00"},{"id":2390299,"file_name":"8.png","project_id":136305,"asset_id":203989,"created_at":"2020-04-10T10:22:51.798+08:00","updated_at":"2020-04-10T10:22:51.798+08:00"},{"id":2390300,"file_name":"9.png","project_id":136305,"asset_id":203990,"created_at":"2020-04-10T10:22:51.800+08:00","updated_at":"2020-04-10T10:22:51.800+08:00"},{"id":2390303,"file_name":"bullet_1.png","project_id":136305,"asset_id":203993,"created_at":"2020-04-10T10:22:53.042+08:00","updated_at":"2020-04-10T10:22:53.042+08:00"},{"id":2390305,"file_name":"d1.png","project_id":136305,"asset_id":203995,"created_at":"2020-04-10T10:22:53.361+08:00","updated_at":"2020-04-10T10:22:53.361+08:00"},{"id":2390306,"file_name":"d2.png","project_id":136305,"asset_id":203996,"created_at":"2020-04-10T10:22:53.363+08:00","updated_at":"2020-04-10T10:22:53.363+08:00"},{"id":2390307,"file_name":"d3.png","project_id":136305,"asset_id":203997,"created_at":"2020-04-10T10:22:53.687+08:00","updated_at":"2020-04-10T10:22:53.687+08:00"},{"id":2390308,"file_name":"d4.png","project_id":136305,"asset_id":203998,"created_at":"2020-04-10T10:22:53.689+08:00","updated_at":"2020-04-10T10:22:53.689+08:00"},{"id":2390313,"file_name":"food_0.png","project_id":136305,"asset_id":203712,"created_at":"2020-04-10T10:22:54.633+08:00","updated_at":"2020-04-10T10:22:54.633+08:00"},{"id":2390314,"file_name":"food_1.png","project_id":136305,"asset_id":204003,"created_at":"2020-04-10T10:22:54.635+08:00","updated_at":"2020-04-10T10:22:54.635+08:00"},{"id":2390304,"file_name":"gameover.png","project_id":136305,"asset_id":203994,"created_at":"2020-04-10T10:22:53.044+08:00","updated_at":"2020-04-10T10:27:29.383+08:00"},{"id":2390291,"file_name":"0.png","project_id":136305,"asset_id":203981,"created_at":"2020-04-10T10:22:50.515+08:00","updated_at":"2020-04-10T10:22:50.515+08:00"},{"id":2390292,"file_name":"1.png","project_id":136305,"asset_id":203982,"created_at":"2020-04-10T10:22:50.516+08:00","updated_at":"2020-04-10T10:22:50.516+08:00"},{"id":2390309,"file_name":"d5.png","project_id":136305,"asset_id":203999,"created_at":"2020-04-10T10:22:54.001+08:00","updated_at":"2020-04-10T10:22:54.001+08:00"},{"id":2390310,"file_name":"d6.png","project_id":136305,"asset_id":204000,"created_at":"2020-04-10T10:22:54.003+08:00","updated_at":"2020-04-10T10:22:54.003+08:00"},{"id":2390293,"file_name":"2.png","project_id":136305,"asset_id":203983,"created_at":"2020-04-10T10:22:50.833+08:00","updated_at":"2020-04-10T10:22:50.833+08:00"},{"id":2390294,"file_name":"3.png","project_id":136305,"asset_id":203984,"created_at":"2020-04-10T10:22:50.835+08:00","updated_at":"2020-04-10T10:22:50.835+08:00"},{"id":2390301,"file_name":"bg.png","project_id":136305,"asset_id":203991,"created_at":"2020-04-10T10:22:52.633+08:00","updated_at":"2020-04-10T10:22:52.633+08:00"},{"id":2390302,"file_name":"bullet_0.png","project_id":136305,"asset_id":203992,"created_at":"2020-04-10T10:22:52.634+08:00","updated_at":"2020-04-10T10:22:52.634+08:00"},{"id":2390311,"file_name":"d7.png","project_id":136305,"asset_id":204001,"created_at":"2020-04-10T10:22:54.311+08:00","updated_at":"2020-04-10T10:22:54.311+08:00"},{"id":2390312,"file_name":"flame.png","project_id":136305,"asset_id":204002,"created_at":"2020-04-10T10:22:54.313+08:00","updated_at":"2020-04-10T10:22:54.313+08:00"},{"id":2390315,"file_name":"food_2.png","project_id":136305,"asset_id":204004,"created_at":"2020-04-10T10:22:54.951+08:00","updated_at":"2020-04-10T10:22:54.951+08:00"},{"id":2390316,"file_name":"player.png","project_id":136305,"asset_id":204005,"created_at":"2020-04-10T10:22:54.953+08:00","updated_at":"2020-04-10T10:22:54.953+08:00"},{"id":2390295,"file_name":"4.png","project_id":136305,"asset_id":203985,"created_at":"2020-04-10T10:22:51.147+08:00","updated_at":"2020-04-10T10:22:51.147+08:00"},{"id":2390296,"file_name":"5.png","project_id":136305,"asset_id":203986,"created_at":"2020-04-10T10:22:51.148+08:00","updated_at":"2020-04-10T10:22:51.148+08:00"},{"id":2873293,"file_name":"d0.png","project_id":136305,"asset_id":237098,"created_at":"2020-07-13T12:28:29.699+08:00","updated_at":"2020-08-17T16:04:20.552+08:00"},{"id":3108376,"file_name":"boom.wav","project_id":136305,"asset_id":250885,"created_at":"2020-08-17T15:36:34.622+08:00","updated_at":"2020-08-17T15:36:34.622+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦