{"id":183270,"student_id":2589,"content":"","created_at":"2020-08-20T15:44:22.775+08:00","updated_at":"2020-08-20T15:45:11.672+08:00","name":"海底探險(試玩版)","language":"javascript","screenshot":{"url":null},"parent_id":136468,"plugin":"Game.set({width: 1200, height: 900})\n\nvar bg = createSprite('bg.png'); //背景圖\nvar player = createSprite('player.png'); //潛水艇\nvar hint = createSprite('hint.png'); //提示教學\n\nvar vy = 0; //墜落速度\nvar level = 0; //分數\nvar initY = 450; //當前最新的障礙物座標\nvar isStart = false; //是否開始遊戲\nvar rocks = []; //存放障礙物\nvar bubbles = []; //存放泡泡\n\nsound.play('bgm.ogg', true);\n\n//初始化水晶\nfor (var i = 0; i \u003c 17; i++) {\n var r = createSprite('b0.png', 'b1.png', 'b2.png', 'b3.png', 'b4.png', 'b5.png', 'b6.png', 'b7.png', 'b8.png', 'b9.png', 'b10.png');\n r.x = i*75;\n rocks.push(r);\n}\n\n//初始化泡泡\nfor (var i = 0; i \u003c 21; i++) {\n var b = createSprite('bubble.png');\n b.x = i*30;\n bubbles.push(b);\n}\n\nforever(loop); //重複不斷執行遊戲回圈\n\n//遊戲主迴圈\nfunction loop () {\n for (var i = 0; i \u003c 17; i++) {\n var r = rocks[i];\n r.x -= 8;\n if (r.x \u003c -30) {\n r.x += 1275;\n if (isStart) {\n initY += Math.random()*120 - 60; //相鄰的水晶高度差不超過 60\n }\n if (initY \u003c 300) {\n initY = 300;\n }\n if (initY \u003e 600) {\n initY = 600;\n }\n r.y = initY;\n\n if (level \u003c 30) {\n r.costumeId = 0;\n } else if (level \u003c 60) {\n r.costumeId = 1;\n } else if (level \u003c 90) {\n r.costumeId = 2;\n } else if (level \u003c 120) {\n r.costumeId = 3;\n } else if (level \u003c 150) {\n r.costumeId = 4;\n } else if (level \u003c 180) {\n r.costumeId = 5;\n } else if (level \u003c 210) {\n r.costumeId = 6;\n } else if (level \u003c 240) {\n r.costumeId = 7;\n } else if (level \u003c 270) {\n r.costumeId = 8;\n } else {\n r.costumeId = 9;\n }\n if (isStart) {\n level++;\n }\n }\n }\n if (key.space) {\n vy -= 0.6;\n isStart = true;\n }\n if (isStart) {\n vy += 0.3;\n player.y += vy;\n player.direction = 90 + vy*2; //根據墜落速度傾斜\n hint.hidden = true;\n }\n if (player.touched(rocks)) {\n stop();\n }\n for (var i = 0; i \u003c 21; i++) {\n var b = bubbles[i];\n b.x -= 7;\n b.y -= 2;\n b.scale = b.x/600;\n b.opacity = b.x/600;\n if (b.x \u003c -10) {\n b.x = player.x - Math.random()*20 - 60;\n b.y = player.y + Math.random()*20;\n }\n }\n\n bg.x -= 0.3;\n if (bg.x \u003c -1200) {\n bg.x += 2400;\n }\n\n drawText(level + 'm', 10, 10, 'white', 60);\n}\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":71,"hashid":"5j3sk2pj","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3116742,"file_name":"player.png","project_id":183270,"asset_id":251473,"created_at":"2020-08-20T15:44:22.781+08:00","updated_at":"2020-08-20T15:44:22.781+08:00"},{"id":3116743,"file_name":"hint.png","project_id":183270,"asset_id":251472,"created_at":"2020-08-20T15:44:22.782+08:00","updated_at":"2020-08-20T15:44:22.782+08:00"},{"id":3116744,"file_name":"bubble.png","project_id":183270,"asset_id":251471,"created_at":"2020-08-20T15:44:22.783+08:00","updated_at":"2020-08-20T15:44:22.783+08:00"},{"id":3116745,"file_name":"bg.png","project_id":183270,"asset_id":251470,"created_at":"2020-08-20T15:44:22.784+08:00","updated_at":"2020-08-20T15:44:22.784+08:00"},{"id":3116746,"file_name":"b10.png","project_id":183270,"asset_id":251468,"created_at":"2020-08-20T15:44:22.785+08:00","updated_at":"2020-08-20T15:44:22.785+08:00"},{"id":3116747,"file_name":"b9.png","project_id":183270,"asset_id":251467,"created_at":"2020-08-20T15:44:22.786+08:00","updated_at":"2020-08-20T15:44:22.786+08:00"},{"id":3116748,"file_name":"b8.png","project_id":183270,"asset_id":251466,"created_at":"2020-08-20T15:44:22.787+08:00","updated_at":"2020-08-20T15:44:22.787+08:00"},{"id":3116749,"file_name":"b7.png","project_id":183270,"asset_id":251465,"created_at":"2020-08-20T15:44:22.787+08:00","updated_at":"2020-08-20T15:44:22.787+08:00"},{"id":3116750,"file_name":"b6.png","project_id":183270,"asset_id":251464,"created_at":"2020-08-20T15:44:22.788+08:00","updated_at":"2020-08-20T15:44:22.788+08:00"},{"id":3116751,"file_name":"b5.png","project_id":183270,"asset_id":251463,"created_at":"2020-08-20T15:44:22.789+08:00","updated_at":"2020-08-20T15:44:22.789+08:00"},{"id":3116752,"file_name":"b4.png","project_id":183270,"asset_id":251462,"created_at":"2020-08-20T15:44:22.790+08:00","updated_at":"2020-08-20T15:44:22.790+08:00"},{"id":3116753,"file_name":"b3.png","project_id":183270,"asset_id":251461,"created_at":"2020-08-20T15:44:22.791+08:00","updated_at":"2020-08-20T15:44:22.791+08:00"},{"id":3116754,"file_name":"b2.png","project_id":183270,"asset_id":251460,"created_at":"2020-08-20T15:44:22.792+08:00","updated_at":"2020-08-20T15:44:22.792+08:00"},{"id":3116755,"file_name":"b1.png","project_id":183270,"asset_id":251459,"created_at":"2020-08-20T15:44:22.792+08:00","updated_at":"2020-08-20T15:44:22.792+08:00"},{"id":3116756,"file_name":"b0.png","project_id":183270,"asset_id":251458,"created_at":"2020-08-20T15:44:22.793+08:00","updated_at":"2020-08-20T15:44:22.793+08:00"},{"id":3116757,"file_name":"bgm.ogg","project_id":183270,"asset_id":170605,"created_at":"2020-08-20T15:44:22.794+08:00","updated_at":"2020-08-20T15:44:22.794+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦