Spaces:
Running
Running
Upload 2 files
Browse files- function.html +22 -19
- sequence.html +13 -9
function.html
CHANGED
|
@@ -108,8 +108,11 @@
|
|
| 108 |
#virtual-keypad {
|
| 109 |
position: fixed;
|
| 110 |
bottom: 20px;
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
| 113 |
z-index: 1000;
|
| 114 |
background: rgba(15, 23, 42, 0.95);
|
| 115 |
backdrop-filter: blur(10px);
|
|
@@ -268,7 +271,7 @@
|
|
| 268 |
</div>
|
| 269 |
|
| 270 |
<!-- Virtual Keypad HTML -->
|
| 271 |
-
<div id="virtual-keypad">
|
| 272 |
<div class="keypad-handle"></div>
|
| 273 |
<div class="keypad-btn" onclick="keypad.input(1)">1</div>
|
| 274 |
<div class="keypad-btn" onclick="keypad.input(2)">2</div>
|
|
@@ -739,13 +742,13 @@
|
|
| 739 |
case STATE.PHASE1_INTRO:
|
| 740 |
formulaBanner.classList.remove('hidden');
|
| 741 |
html = `
|
| 742 |
-
<h2 class="text-3xl font-bold text-cyan-400 mb-4">核心運作法則確認</h2>
|
| 743 |
<div class="text-center bg-slate-800/80 p-6 rounded-xl border border-cyan-500/30 mb-8">
|
| 744 |
-
<div class="font-tech text-
|
| 745 |
<span class="text-cyan-400">y</span> = 2<span class="text-amber-400">x</span> + 3
|
| 746 |
</div>
|
| 747 |
-
<p class="text-slate-300 text-
|
| 748 |
-
每投入 <span class="text-amber-400 font-bold text-
|
| 749 |
</p>
|
| 750 |
</div>
|
| 751 |
<button onclick="startQPhase()" class="w-full py-5 bg-slate-700 hover:bg-slate-600 text-white rounded-xl font-bold text-xl border border-slate-500">
|
|
@@ -784,7 +787,7 @@
|
|
| 784 |
<div class="text-slate-400 font-bold text-xl border-b border-slate-500/30 pb-2">2. 坐標描點</div>
|
| 785 |
<div class="bg-slate-800/30 p-4 rounded-xl border border-slate-700/30 flex flex-col items-center justify-center flex-grow">
|
| 786 |
<div class="text-sm text-slate-500 mb-1">對應座標</div>
|
| 787 |
-
<div class="font-tech text-
|
| 788 |
(<span class="text-amber-400">${xVal}</span>, <span class="text-cyan-400">y</span>)
|
| 789 |
</div>
|
| 790 |
</div>
|
|
@@ -831,7 +834,7 @@
|
|
| 831 |
<div id="coord-step-1" class="flex flex-col gap-4 h-full">
|
| 832 |
<div class="bg-slate-800/80 p-4 rounded-xl border border-cyan-500/50 flex flex-col items-center justify-center flex-grow">
|
| 833 |
<div class="text-sm text-cyan-300 font-bold mb-2 tracking-widest">對應座標</div>
|
| 834 |
-
<div class="font-tech text-
|
| 835 |
(<span class="text-amber-400">${xValC}</span>, <span class="text-cyan-400">y</span>)
|
| 836 |
</div>
|
| 837 |
</div>
|
|
@@ -844,7 +847,7 @@
|
|
| 844 |
<div id="coord-step-2" class="hidden flex flex-col gap-4 h-full">
|
| 845 |
<div class="bg-slate-800/80 p-4 rounded-xl border border-cyan-500 shadow-[0_0_20px_rgba(34,211,238,0.2)] flex flex-col items-center justify-center relative overflow-hidden transform transition-all flex-grow animate-pulse-once">
|
| 846 |
<div class="text-sm text-cyan-300 font-bold mb-2 tracking-widest">對應座標</div>
|
| 847 |
-
<div class="font-tech text-
|
| 848 |
(<span class="text-amber-400">${xValC}</span>, <span class="text-cyan-400">${yValC}</span>)
|
| 849 |
</div>
|
| 850 |
<div class="absolute inset-0 bg-cyan-500/10 animate-pulse"></div>
|
|
@@ -924,11 +927,11 @@
|
|
| 924 |
|
| 925 |
<!-- Teaching Content -->
|
| 926 |
<div class="bg-slate-800/80 p-4 rounded-xl border border-cyan-500/30 mb-6 text-left">
|
| 927 |
-
<h3 class="text-
|
| 928 |
-
<p class="text-slate-200 text-
|
| 929 |
-
剛剛我們使用的「能量轉換法則」,在數學上就叫做<span class="text-amber-400 font-bold text-
|
| 930 |
</p>
|
| 931 |
-
<p class="text-slate-300 text-
|
| 932 |
函數就像一座<span class="text-cyan-400 font-bold">工廠</span>:<br>
|
| 933 |
它會把原料 <span class="font-bold text-amber-400">x (晶石)</span>,藉由固定的規則,<br>轉換成產品 <span class="font-bold text-cyan-400">y (電力)</span>。
|
| 934 |
</p>
|
|
@@ -973,14 +976,14 @@
|
|
| 973 |
case STATE.PHASE4_TEST_B:
|
| 974 |
formulaBanner.classList.remove('hidden'); // Ensure banner is visible
|
| 975 |
html = `
|
| 976 |
-
<h3 class="text-3xl font-bold text-white mb-2">步驟 1:數據校準
|
| 977 |
<p class="text-slate-300 mb-4">
|
| 978 |
你需要測試不同的晶石投入量,來推導出新的公式。
|
| 979 |
<br><span class="text-base text-slate-400">提示:什麼時候 <span class="text-red-400">a</span> 會消失不見? (試試投入 0 顆)</span>
|
| 980 |
</p>
|
| 981 |
<div class="flex items-center gap-2 mt-4 bg-slate-800/50 p-4 rounded-xl justify-center flex-wrap">
|
| 982 |
<span class="font-tech text-amber-400 text-3xl whitespace-nowrap">投入 x = </span>
|
| 983 |
-
<input id="test-input" type="
|
| 984 |
<button onclick="runPhase4Test()" class="px-6 py-2 bg-amber-600 hover:bg-amber-500 text-white rounded font-bold shadow-lg whitespace-nowrap">
|
| 985 |
啟動運作
|
| 986 |
</button>
|
|
@@ -1016,7 +1019,7 @@
|
|
| 1016 |
case STATE.PHASE4_TEST_A:
|
| 1017 |
formulaBanner.classList.remove('hidden');
|
| 1018 |
html = `
|
| 1019 |
-
<h3 class="text-3xl font-bold text-white mb-2">步驟 2:數據校準
|
| 1020 |
<p class="text-slate-300 mb-4">
|
| 1021 |
現在已知 b=5。接下來需要找出變化率 a。
|
| 1022 |
<br><span class="text-base text-slate-400">提示:試試看投入 1 顆晶石?</span>
|
|
@@ -1139,10 +1142,10 @@
|
|
| 1139 |
|
| 1140 |
html = `
|
| 1141 |
<div class="text-center w-full h-full flex flex-col items-center">
|
| 1142 |
-
<h2 class="text-
|
| 1143 |
任務完成 SYSTEM RESTORED
|
| 1144 |
</h2>
|
| 1145 |
-
<div class="text-amber-400 font-tech text-
|
| 1146 |
|
| 1147 |
<!-- Score Board -->
|
| 1148 |
<div class="flex gap-16 mb-10 bg-slate-800/80 px-16 py-8 rounded-3xl border-2 border-slate-600 transform scale-110">
|
|
|
|
| 108 |
#virtual-keypad {
|
| 109 |
position: fixed;
|
| 110 |
bottom: 20px;
|
| 111 |
+
right: 20px;
|
| 112 |
+
left: auto;
|
| 113 |
+
/* Remove centering */
|
| 114 |
+
transform: translateY(120%);
|
| 115 |
+
/* Start hidden down */
|
| 116 |
z-index: 1000;
|
| 117 |
background: rgba(15, 23, 42, 0.95);
|
| 118 |
backdrop-filter: blur(10px);
|
|
|
|
| 271 |
</div>
|
| 272 |
|
| 273 |
<!-- Virtual Keypad HTML -->
|
| 274 |
+
<div id="virtual-keypad" onclick="event.stopPropagation()">
|
| 275 |
<div class="keypad-handle"></div>
|
| 276 |
<div class="keypad-btn" onclick="keypad.input(1)">1</div>
|
| 277 |
<div class="keypad-btn" onclick="keypad.input(2)">2</div>
|
|
|
|
| 742 |
case STATE.PHASE1_INTRO:
|
| 743 |
formulaBanner.classList.remove('hidden');
|
| 744 |
html = `
|
| 745 |
+
<h2 class="text-2xl md:text-3xl font-bold text-cyan-400 mb-4">核心運作法則確認</h2>
|
| 746 |
<div class="text-center bg-slate-800/80 p-6 rounded-xl border border-cyan-500/30 mb-8">
|
| 747 |
+
<div class="font-tech text-3xl md:text-6xl mb-6">
|
| 748 |
<span class="text-cyan-400">y</span> = 2<span class="text-amber-400">x</span> + 3
|
| 749 |
</div>
|
| 750 |
+
<p class="text-slate-300 text-xl md:text-4xl leading-relaxed font-bold">
|
| 751 |
+
每投入 <span class="text-amber-400 font-bold text-4xl md:text-7xl mx-2 border-b-2 border-amber-400/50">x</span> 顆晶石,<br>就會產生 <span class="text-cyan-400 font-bold text-4xl md:text-7xl mx-2 border-b-2 border-cyan-400/50">y</span> 點電力。
|
| 752 |
</p>
|
| 753 |
</div>
|
| 754 |
<button onclick="startQPhase()" class="w-full py-5 bg-slate-700 hover:bg-slate-600 text-white rounded-xl font-bold text-xl border border-slate-500">
|
|
|
|
| 787 |
<div class="text-slate-400 font-bold text-xl border-b border-slate-500/30 pb-2">2. 坐標描點</div>
|
| 788 |
<div class="bg-slate-800/30 p-4 rounded-xl border border-slate-700/30 flex flex-col items-center justify-center flex-grow">
|
| 789 |
<div class="text-sm text-slate-500 mb-1">對應座標</div>
|
| 790 |
+
<div class="font-tech text-xl md:text-3xl font-bold text-slate-500">
|
| 791 |
(<span class="text-amber-400">${xVal}</span>, <span class="text-cyan-400">y</span>)
|
| 792 |
</div>
|
| 793 |
</div>
|
|
|
|
| 834 |
<div id="coord-step-1" class="flex flex-col gap-4 h-full">
|
| 835 |
<div class="bg-slate-800/80 p-4 rounded-xl border border-cyan-500/50 flex flex-col items-center justify-center flex-grow">
|
| 836 |
<div class="text-sm text-cyan-300 font-bold mb-2 tracking-widest">對應座標</div>
|
| 837 |
+
<div class="font-tech text-2xl md:text-4xl font-bold z-10 mb-2">
|
| 838 |
(<span class="text-amber-400">${xValC}</span>, <span class="text-cyan-400">y</span>)
|
| 839 |
</div>
|
| 840 |
</div>
|
|
|
|
| 847 |
<div id="coord-step-2" class="hidden flex flex-col gap-4 h-full">
|
| 848 |
<div class="bg-slate-800/80 p-4 rounded-xl border border-cyan-500 shadow-[0_0_20px_rgba(34,211,238,0.2)] flex flex-col items-center justify-center relative overflow-hidden transform transition-all flex-grow animate-pulse-once">
|
| 849 |
<div class="text-sm text-cyan-300 font-bold mb-2 tracking-widest">對應座標</div>
|
| 850 |
+
<div class="font-tech text-2xl md:text-4xl font-bold z-10 mb-2">
|
| 851 |
(<span class="text-amber-400">${xValC}</span>, <span class="text-cyan-400">${yValC}</span>)
|
| 852 |
</div>
|
| 853 |
<div class="absolute inset-0 bg-cyan-500/10 animate-pulse"></div>
|
|
|
|
| 927 |
|
| 928 |
<!-- Teaching Content -->
|
| 929 |
<div class="bg-slate-800/80 p-4 rounded-xl border border-cyan-500/30 mb-6 text-left">
|
| 930 |
+
<h3 class="text-lg md:text-3xl font-bold text-white mb-2 text-center">任務小結:什麼是「函數」?</h3>
|
| 931 |
+
<p class="text-slate-200 text-base md:text-2xl leading-relaxed mb-3">
|
| 932 |
+
剛剛我們使用的「能量轉換法則」,在數學上就叫做<span class="text-amber-400 font-bold text-xl md:text-3xl mx-1">「函數」(Function)</span>。
|
| 933 |
</p>
|
| 934 |
+
<p class="text-slate-300 text-base md:text-2xl leading-relaxed">
|
| 935 |
函數就像一座<span class="text-cyan-400 font-bold">工廠</span>:<br>
|
| 936 |
它會把原料 <span class="font-bold text-amber-400">x (晶石)</span>,藉由固定的規則,<br>轉換成產品 <span class="font-bold text-cyan-400">y (電力)</span>。
|
| 937 |
</p>
|
|
|
|
| 976 |
case STATE.PHASE4_TEST_B:
|
| 977 |
formulaBanner.classList.remove('hidden'); // Ensure banner is visible
|
| 978 |
html = `
|
| 979 |
+
<h3 class="text-3xl font-bold text-white mb-2">步驟 1:數據校準 b</h3>
|
| 980 |
<p class="text-slate-300 mb-4">
|
| 981 |
你需要測試不同的晶石投入量,來推導出新的公式。
|
| 982 |
<br><span class="text-base text-slate-400">提示:什麼時候 <span class="text-red-400">a</span> 會消失不見? (試試投入 0 顆)</span>
|
| 983 |
</p>
|
| 984 |
<div class="flex items-center gap-2 mt-4 bg-slate-800/50 p-4 rounded-xl justify-center flex-wrap">
|
| 985 |
<span class="font-tech text-amber-400 text-3xl whitespace-nowrap">投入 x = </span>
|
| 986 |
+
<input id="test-input" type="text" readonly onclick="keypad.open(this)" class="tech-input w-24 p-2 rounded text-3xl text-amber-400 text-center" placeholder="0" value="0">
|
| 987 |
<button onclick="runPhase4Test()" class="px-6 py-2 bg-amber-600 hover:bg-amber-500 text-white rounded font-bold shadow-lg whitespace-nowrap">
|
| 988 |
啟動運作
|
| 989 |
</button>
|
|
|
|
| 1019 |
case STATE.PHASE4_TEST_A:
|
| 1020 |
formulaBanner.classList.remove('hidden');
|
| 1021 |
html = `
|
| 1022 |
+
<h3 class="text-3xl font-bold text-white mb-2">步驟 2:數據校準 a</h3>
|
| 1023 |
<p class="text-slate-300 mb-4">
|
| 1024 |
現在已知 b=5。接下來需要找出變化率 a。
|
| 1025 |
<br><span class="text-base text-slate-400">提示:試試看投入 1 顆晶石?</span>
|
|
|
|
| 1142 |
|
| 1143 |
html = `
|
| 1144 |
<div class="text-center w-full h-full flex flex-col items-center">
|
| 1145 |
+
<h2 class="text-2xl md:text-6xl font-black text-transparent bg-clip-text bg-gradient-to-r from-cyan-400 to-green-400 mb-6 drop-shadow-[0_0_15px_rgba(34,211,238,0.6)] tracking-widest">
|
| 1146 |
任務完成 SYSTEM RESTORED
|
| 1147 |
</h2>
|
| 1148 |
+
<div class="text-amber-400 font-tech text-lg md:text-4xl mb-10 tracking-[0.5em]">MISSION ACCOMPLISHED</div>
|
| 1149 |
|
| 1150 |
<!-- Score Board -->
|
| 1151 |
<div class="flex gap-16 mb-10 bg-slate-800/80 px-16 py-8 rounded-3xl border-2 border-slate-600 transform scale-110">
|
sequence.html
CHANGED
|
@@ -292,8 +292,11 @@
|
|
| 292 |
#virtual-keypad {
|
| 293 |
position: fixed;
|
| 294 |
bottom: 20px;
|
| 295 |
-
|
| 296 |
-
|
|
|
|
|
|
|
|
|
|
| 297 |
z-index: 1000;
|
| 298 |
background: rgba(15, 23, 42, 0.95);
|
| 299 |
backdrop-filter: blur(10px);
|
|
@@ -311,12 +314,13 @@
|
|
| 311 |
}
|
| 312 |
|
| 313 |
#virtual-keypad.active {
|
| 314 |
-
|
|
|
|
|
|
|
| 315 |
}
|
| 316 |
|
| 317 |
#virtual-keypad.dragging {
|
| 318 |
transition: none;
|
| 319 |
-
transform: none;
|
| 320 |
}
|
| 321 |
|
| 322 |
.keypad-handle {
|
|
@@ -419,7 +423,7 @@
|
|
| 419 |
</div>
|
| 420 |
|
| 421 |
<!-- Virtual Keypad HTML -->
|
| 422 |
-
<div id="virtual-keypad">
|
| 423 |
<div class="keypad-handle"></div>
|
| 424 |
<div class="keypad-btn" onclick="keypad.input(1)">1</div>
|
| 425 |
<div class="keypad-btn" onclick="keypad.input(2)">2</div>
|
|
@@ -1002,7 +1006,7 @@
|
|
| 1002 |
const groundY = height * 0.7;
|
| 1003 |
platforms.push({ x: 0, y: groundY, w: 1000, h: 40, type: 'safe', visited: true });
|
| 1004 |
player.x = 200; player.y = groundY - 54; player.isGrounded = true; player.prevY = player.y; cameraX = 0; cameraY = 0;
|
| 1005 |
-
checkpoints = [{ x: 600, y: groundY -
|
| 1006 |
tutorial.step = 0;
|
| 1007 |
updateTutorialUI("基礎移動", "請往右移動,觸碰黃色光柱");
|
| 1008 |
if (!isLooping) { lastTime = performance.now(); loop(lastTime); }
|
|
@@ -1012,15 +1016,15 @@
|
|
| 1012 |
playSound('collect');
|
| 1013 |
tutorial.step = 1; checkpoints = [];
|
| 1014 |
const groundY = height * 0.7;
|
| 1015 |
-
checkpoints.push({ x: 200, y: groundY -
|
| 1016 |
updateTutorialUI("折返跑", "做得好!現在請折返往左移動");
|
| 1017 |
}
|
| 1018 |
|
| 1019 |
function generateJumpTutorial() {
|
| 1020 |
playSound('collect');
|
| 1021 |
tutorial.step = 2; updateTutorialUI("跳躍訓練", "分別使用一段、二段、三段跳撞擊方塊");
|
| 1022 |
-
//
|
| 1023 |
-
platforms =
|
| 1024 |
|
| 1025 |
// Determine start X relative to player to ensure continuity
|
| 1026 |
const startX = Math.max(player.x + 400, 600);
|
|
|
|
| 292 |
#virtual-keypad {
|
| 293 |
position: fixed;
|
| 294 |
bottom: 20px;
|
| 295 |
+
right: 20px;
|
| 296 |
+
left: auto;
|
| 297 |
+
/* Remove centering */
|
| 298 |
+
transform: translateY(120%);
|
| 299 |
+
/* Start hidden down */
|
| 300 |
z-index: 1000;
|
| 301 |
background: rgba(15, 23, 42, 0.95);
|
| 302 |
backdrop-filter: blur(10px);
|
|
|
|
| 314 |
}
|
| 315 |
|
| 316 |
#virtual-keypad.active {
|
| 317 |
+
visibility: visible;
|
| 318 |
+
opacity: 1;
|
| 319 |
+
transform: translateY(0);
|
| 320 |
}
|
| 321 |
|
| 322 |
#virtual-keypad.dragging {
|
| 323 |
transition: none;
|
|
|
|
| 324 |
}
|
| 325 |
|
| 326 |
.keypad-handle {
|
|
|
|
| 423 |
</div>
|
| 424 |
|
| 425 |
<!-- Virtual Keypad HTML -->
|
| 426 |
+
<div id="virtual-keypad" onclick="event.stopPropagation()">
|
| 427 |
<div class="keypad-handle"></div>
|
| 428 |
<div class="keypad-btn" onclick="keypad.input(1)">1</div>
|
| 429 |
<div class="keypad-btn" onclick="keypad.input(2)">2</div>
|
|
|
|
| 1006 |
const groundY = height * 0.7;
|
| 1007 |
platforms.push({ x: 0, y: groundY, w: 1000, h: 40, type: 'safe', visited: true });
|
| 1008 |
player.x = 200; player.y = groundY - 54; player.isGrounded = true; player.prevY = player.y; cameraX = 0; cameraY = 0;
|
| 1009 |
+
checkpoints = [{ x: 600, y: groundY - 60, w: 40, h: 60, active: true, type: 'right' }];
|
| 1010 |
tutorial.step = 0;
|
| 1011 |
updateTutorialUI("基礎移動", "請往右移動,觸碰黃色光柱");
|
| 1012 |
if (!isLooping) { lastTime = performance.now(); loop(lastTime); }
|
|
|
|
| 1016 |
playSound('collect');
|
| 1017 |
tutorial.step = 1; checkpoints = [];
|
| 1018 |
const groundY = height * 0.7;
|
| 1019 |
+
checkpoints.push({ x: 200, y: groundY - 60, w: 40, h: 60, active: true, type: 'left' });
|
| 1020 |
updateTutorialUI("折返跑", "做得好!現在請折返往左移動");
|
| 1021 |
}
|
| 1022 |
|
| 1023 |
function generateJumpTutorial() {
|
| 1024 |
playSound('collect');
|
| 1025 |
tutorial.step = 2; updateTutorialUI("跳躍訓練", "分別使用一段、二段、三段跳撞擊方塊");
|
| 1026 |
+
// Clear platforms to prevent overlap ("extra platform" fix)
|
| 1027 |
+
platforms = []; checkpoints = [];
|
| 1028 |
|
| 1029 |
// Determine start X relative to player to ensure continuity
|
| 1030 |
const startX = Math.max(player.x + 400, 600);
|