{"id":23616,"student_id":10,"content":"// 遊戲進度\n// 0: 一開始, 1: 取得火把, 2: 點燃火把, 3: 取得捲軸\nvar status = 0;\n\n// 房間造型編號 \n// 0: 大廳, 1: 偏廳, 2: 地下室, 3: 壁畫牆壁, 4: 火把牆壁, 5; 火爐\nvar rooms = createSprite({\n x: 320,\n y: 280,\n scale: 0.35,\n costumes: [\"room_1.png\", \"room_2.png\", \"room_3.png\", \"room_4.png\", \"room_5.png\", \"room_6.png\"]\n});\n\n// 往右的箭頭\nvar way1 = createSprite({\n x: 600,\n y: 290,\n scale: 0.25,\n costumes: [\"888.png\"]\n});\n\n// 往左的箭頭\nvar way2 = createSprite({\n x: 40,\n y: 290,\n scale: 0.25,\n costumes: [\"88.png\"]\n});\n\n// 進入地下室\nvar basement_enter = createSprite({\n x: 560,\n y: 350,\n scale: 0.35,\n costumes: [\"96.png\"]\n});\n\n// 離開地下室\nvar basement_exit = createSprite({\n x: 100,\n y: 415,\n scale: 0.35,\n costumes: [\"859.png\"]\n});\n\n// 道具蒐集框\nvar tools = createSprite({\n x: 320,\n y: 48,\n scale: 1,\n costumes: [\"素材.png\"],\n});\n\n// 牆壁上的圖畫(遠看)\nvar mural = createSprite({\n x: 50,\n y: 260,\n scale: 0.185,\n costumes: [\"555.png\"]\n});\n\n// 牆壁上的圖畫(近看)\nvar mural_large = createSprite({\n x: 300,\n y: 290,\n scale: 0.8,\n costumes: [\"畫2.jpg\"],\n layer: 1\n});\n\n// 隱藏暗格\nvar dark_box = createSprite({\n x: 310,\n y: 290,\n scale: 0.48,\n costumes: [\"暗格1.jpg\", \"暗格2.jpg\"]\n});\n\n// 關閉的 X 符號\nvar XX = createSprite({\n x: 585,\n y: 150,\n scale: 0.7,\n costumes: [\"XX.png\"]\n});\n\n// 火把小圖\nvar mini_fire = createSprite({\n x: 70,\n y: 245,\n scale: 0.25,\n costumes: [\"火把小圖.png\"]\n});\n\n// 火把\nvar fire = createSprite({\n x: 320,\n y: 240,\n scale: 0.7,\n costumes: [\"886.png\", \"887.png\", \"火把.png\", \"火把2.png\"]\n});\n\n// 火爐\nvar stove = createSprite({\n x: 497,\n y: 350,\n scale: 0.35,\n costumes: [\"火爐小圖.png\"]\n});\n\n// 文字捲\nvar reel = createSprite({\n x: 310,\n y: 300,\n scale: 0.7,\n costumes: [\"象形文字紙捲.png\"],\n hidden: true\n});\n\n// 不斷偵測玩家所在的房間,去顯示隱藏遊戲中的物件\nrooms.forever(function () {\n var id = rooms.costumeId; // 取得當前所在的房間\n\n way1.hidden = (id != 0);\n way2.hidden = (id != 1);\n basement_enter.hidden = (id != 1);\n basement_exit.hidden = (id != 2);\n stove.hidden = (id != 0);\n XX.hidden = (id != 3 \u0026\u0026 id != 4 \u0026\u0026 id != 5);\n fire.hidden = (id != 4 \u0026\u0026 status == 0);\n mini_fire.hidden = (id != 1 || status != 0);\n mural.hidden = (id != 2);\n mural_large.hidden = (id != 3);\n dark_box.hidden = (id != 3);\n});\n\n// 往右的箭頭被點擊\nway1.on(\"click\", function () {\n rooms.costumeId = 1;\n});\n\n// 往右的箭頭被點擊\nway2.on(\"click\", function () {\n rooms.costumeId = 0;\n});\n\n// 進入地下室\nbasement_enter.on(\"click\", function () {\n rooms.costumeId = 2;\n});\n\n// 離開地下室\nbasement_exit.on(\"click\", function () {\n rooms.costumeId = 1;\n});\n\n// 查看火爐\nstove.on('click', function () {\n rooms.costumeId = 5;\n rooms.scale = 0.5\n});\n\n// 查看火把\nmini_fire.on('click', function () {\n rooms.costumeId = 4;\n rooms.scale = 0.5\n});\n\n// 查看壁畫\nmural.on('click', function () {\n rooms.costumeId = 3;\n});\n\n// 離開火爐、離開壁畫、離開火把牆壁\nXX.on('click', function () {\n if (rooms.costumeId == 4) {\n rooms.costumeId = 1;\n }\n if (rooms.costumeId == 3) {\n rooms.costumeId = 2;\n }\n if (rooms.costumeId == 5) {\n rooms.costumeId = 0;\n }\n rooms.scale = 0.35;\n});\n\n// 點擊火把\nfire.on(\"click\", function () {\n // 取得火把\n if (status == 0) {\n status = 1;\n fire.scale = 0.3;\n fire.x = 100;\n fire.y = 50;\n // 火把選取、取消(尚未點燃)\n } else if (status == 1) {\n if (fire.costumeId == 0) {\n fire.costumeId = 1;\n } else {\n fire.costumeId = 0;\n }\n // 火把選取、取消(已點燃)\n } else if (status == 2) {\n if (fire.costumeId == 3) {\n fire.costumeId = 2;\n } else {\n fire.costumeId = 3;\n }\n }\n});\n\n// 點擊火爐時且取得火把且火把已選取則將火把點燃\nrooms.on(\"click\", function () {\n if (status == 1 \u0026\u0026 rooms.costumeId == 5 \u0026\u0026 fire.costumeId == 1) {\n fire.x += 300;\n fire.y += 200;\n fire.scale += 0.5;\n setTimeout(function () {\n fire.costumeId = 2;\n status = 2; // 取得火把,將狀態設為 2\n }, 1000);\n setTimeout(function () {\n fire.x -= 300;\n fire.y -= 200;\n fire.scale -= 0.5;\n }, 2000);\n }\n});\n\n// 移開壁畫\nmural_large.on('click', function () {\n mural_large.x = -100;\n});\n\n// 如果有點燃火把且選取則顯示捲軸\ndark_box.on(\"click\", function(){\n if (status == 2 \u0026\u0026 fire.costumeId == 3) {\n fire.x += 300;\n fire.y += 200;\n fire.scale += 0.5;\n setTimeout(function () {\n reel.hidden = false;\n }, 1000);\n setTimeout(function () {\n fire.x -= 300;\n fire.y -= 200;\n fire.scale -= 0.5;\n }, 2000);\n }\n});\n\n// 收集捲軸\nreel.on('click', function () {\n status = 3; // 將狀態設為 3\n reel.x = 170;\n reel.y = 50;\n reel.scale = 0.3;\n reel2 = 1;\n});","created_at":"2018-03-06T09:39:58.613+08:00","updated_at":"2019-11-08T11:28:11.204+08:00","name":"最終密室","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/23616/92b4eb7555f1d5f05aca8fff250e493e.jpg"},"parent_id":22435,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":342,"hashid":"kdmsj44m","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":449487,"file_name":"書(開).png","project_id":23616,"asset_id":54316,"created_at":"2018-03-06T09:39:58.622+08:00","updated_at":"2018-03-06T09:39:58.622+08:00"},{"id":449488,"file_name":"象形文字紙捲打開.jpg","project_id":23616,"asset_id":54315,"created_at":"2018-03-06T09:39:58.627+08:00","updated_at":"2018-03-06T09:39:58.627+08:00"},{"id":449489,"file_name":"887.png","project_id":23616,"asset_id":53313,"created_at":"2018-03-06T09:39:58.628+08:00","updated_at":"2018-03-06T09:39:58.628+08:00"},{"id":449490,"file_name":"火把2.png","project_id":23616,"asset_id":53314,"created_at":"2018-03-06T09:39:58.630+08:00","updated_at":"2018-03-06T09:39:58.630+08:00"},{"id":449491,"file_name":"888.png","project_id":23616,"asset_id":53313,"created_at":"2018-03-06T09:39:58.632+08:00","updated_at":"2018-03-06T09:39:58.632+08:00"},{"id":449493,"file_name":"暗格2.jpg","project_id":23616,"asset_id":53271,"created_at":"2018-03-06T09:39:58.634+08:00","updated_at":"2018-03-06T09:39:58.634+08:00"},{"id":449494,"file_name":"象形文字紙捲.png","project_id":23616,"asset_id":53270,"created_at":"2018-03-06T09:39:58.636+08:00","updated_at":"2018-03-06T09:39:58.636+08:00"},{"id":449495,"file_name":"火把.png","project_id":23616,"asset_id":53268,"created_at":"2018-03-06T09:39:58.637+08:00","updated_at":"2018-03-06T09:39:58.637+08:00"},{"id":449498,"file_name":"火爐小圖.png","project_id":23616,"asset_id":53259,"created_at":"2018-03-06T09:39:58.641+08:00","updated_at":"2018-03-06T09:39:58.641+08:00"},{"id":449499,"file_name":"886.png","project_id":23616,"asset_id":53255,"created_at":"2018-03-06T09:39:58.643+08:00","updated_at":"2018-03-06T09:39:58.643+08:00"},{"id":449501,"file_name":"火把小圖.png","project_id":23616,"asset_id":53023,"created_at":"2018-03-06T09:39:58.646+08:00","updated_at":"2018-03-06T09:39:58.646+08:00"},{"id":449502,"file_name":"火把(熄).png","project_id":23616,"asset_id":53023,"created_at":"2018-03-06T09:39:58.647+08:00","updated_at":"2018-03-06T09:39:58.647+08:00"},{"id":449503,"file_name":"XX.png","project_id":23616,"asset_id":52996,"created_at":"2018-03-06T09:39:58.649+08:00","updated_at":"2018-03-06T09:39:58.649+08:00"},{"id":449504,"file_name":"555.png","project_id":23616,"asset_id":52989,"created_at":"2018-03-06T09:39:58.650+08:00","updated_at":"2018-03-06T09:39:58.650+08:00"},{"id":449506,"file_name":"暗格1.jpg","project_id":23616,"asset_id":52513,"created_at":"2018-03-06T09:39:58.654+08:00","updated_at":"2018-03-06T09:39:58.654+08:00"},{"id":449507,"file_name":"畫2.jpg","project_id":23616,"asset_id":52512,"created_at":"2018-03-06T09:39:58.656+08:00","updated_at":"2018-03-06T09:39:58.656+08:00"},{"id":449508,"file_name":"4-2.png","project_id":23616,"asset_id":52252,"created_at":"2018-03-06T09:39:58.657+08:00","updated_at":"2018-03-06T09:39:58.657+08:00"},{"id":449509,"file_name":"素材.png","project_id":23616,"asset_id":51605,"created_at":"2018-03-06T09:39:58.659+08:00","updated_at":"2018-03-06T09:39:58.659+08:00"},{"id":449510,"file_name":"859.png","project_id":23616,"asset_id":51466,"created_at":"2018-03-06T09:39:58.660+08:00","updated_at":"2018-03-06T09:39:58.660+08:00"},{"id":449511,"file_name":"96.png","project_id":23616,"asset_id":51465,"created_at":"2018-03-06T09:39:58.663+08:00","updated_at":"2018-03-06T09:39:58.663+08:00"},{"id":449512,"file_name":"88.png","project_id":23616,"asset_id":51464,"created_at":"2018-03-06T09:39:58.664+08:00","updated_at":"2018-03-06T09:39:58.664+08:00"},{"id":449513,"file_name":"888.png","project_id":23616,"asset_id":51463,"created_at":"2018-03-06T09:39:58.665+08:00","updated_at":"2018-03-06T09:39:58.665+08:00"},{"id":449492,"file_name":"room_2.png","project_id":23616,"asset_id":53312,"created_at":"2018-03-06T09:39:58.633+08:00","updated_at":"2018-03-06T10:38:09.283+08:00"},{"id":449514,"file_name":"room_3.png","project_id":23616,"asset_id":51458,"created_at":"2018-03-06T09:39:58.667+08:00","updated_at":"2018-03-06T10:38:17.985+08:00"},{"id":449505,"file_name":"room_4.png","project_id":23616,"asset_id":52515,"created_at":"2018-03-06T09:39:58.652+08:00","updated_at":"2018-03-06T10:44:22.355+08:00"},{"id":449500,"file_name":"room_5.png","project_id":23616,"asset_id":53254,"created_at":"2018-03-06T09:39:58.645+08:00","updated_at":"2018-03-06T10:44:39.937+08:00"},{"id":449496,"file_name":"room_6.png","project_id":23616,"asset_id":53266,"created_at":"2018-03-06T09:39:58.639+08:00","updated_at":"2018-03-06T10:44:59.411+08:00"},{"id":449497,"file_name":"room_1.png","project_id":23616,"asset_id":53260,"created_at":"2018-03-06T09:39:58.640+08:00","updated_at":"2018-03-06T10:37:54.156+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦