{"id":136468,"student_id":10,"content":"var 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","created_at":"2020-03-27T16:39:33.565+08:00","updated_at":"2024-01-16T13:28:02.482+08:00","name":"海底探險(完整版)","language":"javascript","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/136468/d7f72eb85f77b49e3fb4f79f33aa33bb.jpg"},"parent_id":113165,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":259,"hashid":"ej9svmqp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3023835,"file_name":"bgm.ogg","project_id":136468,"asset_id":170605,"created_at":"2020-08-03T10:38:44.925+08:00","updated_at":"2020-08-03T10:38:44.925+08:00"},{"id":3116738,"file_name":"bg.png","project_id":136468,"asset_id":251470,"created_at":"2020-08-20T15:43:16.620+08:00","updated_at":"2020-08-20T15:43:16.620+08:00"},{"id":3116739,"file_name":"bubble.png","project_id":136468,"asset_id":251471,"created_at":"2020-08-20T15:43:16.622+08:00","updated_at":"2020-08-20T15:43:16.622+08:00"},{"id":3116728,"file_name":"b2.png","project_id":136468,"asset_id":251460,"created_at":"2020-08-20T15:43:13.400+08:00","updated_at":"2020-08-20T15:43:13.400+08:00"},{"id":3116729,"file_name":"b3.png","project_id":136468,"asset_id":251461,"created_at":"2020-08-20T15:43:13.401+08:00","updated_at":"2020-08-20T15:43:13.401+08:00"},{"id":3116732,"file_name":"b6.png","project_id":136468,"asset_id":251464,"created_at":"2020-08-20T15:43:14.421+08:00","updated_at":"2020-08-20T15:43:14.421+08:00"},{"id":3116733,"file_name":"b7.png","project_id":136468,"asset_id":251465,"created_at":"2020-08-20T15:43:14.422+08:00","updated_at":"2020-08-20T15:43:14.422+08:00"},{"id":3116734,"file_name":"b8.png","project_id":136468,"asset_id":251466,"created_at":"2020-08-20T15:43:14.946+08:00","updated_at":"2020-08-20T15:43:14.946+08:00"},{"id":3116735,"file_name":"b9.png","project_id":136468,"asset_id":251467,"created_at":"2020-08-20T15:43:14.950+08:00","updated_at":"2020-08-20T15:43:14.950+08:00"},{"id":3116726,"file_name":"b0.png","project_id":136468,"asset_id":251458,"created_at":"2020-08-20T15:43:12.899+08:00","updated_at":"2020-08-20T15:43:12.899+08:00"},{"id":3116727,"file_name":"b1.png","project_id":136468,"asset_id":251459,"created_at":"2020-08-20T15:43:12.901+08:00","updated_at":"2020-08-20T15:43:12.901+08:00"},{"id":3116736,"file_name":"b10.png","project_id":136468,"asset_id":251468,"created_at":"2020-08-20T15:43:15.848+08:00","updated_at":"2020-08-20T15:43:15.848+08:00"},{"id":3116730,"file_name":"b4.png","project_id":136468,"asset_id":251462,"created_at":"2020-08-20T15:43:14.003+08:00","updated_at":"2020-08-20T15:43:14.003+08:00"},{"id":3116731,"file_name":"b5.png","project_id":136468,"asset_id":251463,"created_at":"2020-08-20T15:43:14.005+08:00","updated_at":"2020-08-20T15:43:14.005+08:00"},{"id":3116740,"file_name":"hint.png","project_id":136468,"asset_id":251472,"created_at":"2020-08-20T15:43:17.061+08:00","updated_at":"2020-08-20T15:43:17.061+08:00"},{"id":3116741,"file_name":"player.png","project_id":136468,"asset_id":251473,"created_at":"2020-08-20T15:43:17.062+08:00","updated_at":"2020-08-20T15:43:17.062+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦