← กลับรายการ
🎮
ทั่วไป ทุกวัย เกมส์

Magic Motion

โดย พ่อน้องมัฟฟิ่นแอนด์ทรัฟเฟิล · เล่นแล้ว 20 ครั้ง

Create a single-file HTML/CSS/JS game called "Magic Potion" for Thai students. Use Anthropic API for questions. Keep it simple.
Level select screen:

4 buttons: ป.1-3, ป.4-6, ม.1-3, ม.4-6

Game screen:

Dark magical background (deep purple/black gradient)
Center: large cauldron emoji 🪄 with bubbling animation (CSS scale pulse)
Top: potion name e.g. "ยาแห่งปัญญา 🧠" and ingredient checklist (3 ingredients with checkboxes)
Each ingredient has an emoji and name e.g. "🌿 ใบมะกรูด", "🔮 คริสตัล", "💎 เพชร"
Bottom: question text + 4 answer buttons 2x2 grid
Timer bar (15 seconds per question)
HP: 3 hearts ❤️

Mechanic:

Answer correct → ingredient flies into cauldron with animation, checkbox ticked ✅
Answer wrong → red flash, lose 1 HP
All 3 ingredients collected → cauldron bubbles dramatically, "ยาสำเร็จ! 🎉" screen
HP = 0 → "ยาระเบิด! 💥" game over screen
Next level: new potion name + new ingredients + new questions

API call:
javascriptconst subjects = ['วิทยาศาสตร์','คณิตศาสตร์','ภาษาไทย','ภาษาอังกฤษ','สังคมศึกษา'];
const subject = subjects[Math.floor(Math.random()*subjects.length)];
const res = await fetch("https://api.anthropic.com/v1/messages", {
method: "POST",
headers: {"Content-Type":"application/json","anthropic-dangerous-direct-browser-calls":"true"},
body: JSON.stringify({
model: "claude-sonnet-4-20250514",
max_tokens: 500,
messages: [{
role: "user",
content: `สร้างโจทย์วิชา${subject} ระดับ${level} 1 ข้อ ตอบ JSON เท่านั้น: {"question":"?","options":["ก.","ข.","ค.","ง."],"answer":"ตัวเลือกที่ถูก"}`
}]
})
});
Potion names (random each level):
ยาแห่งปัญญา 🧠, ยาแห่งพลัง 💪, ยาแห่งความเร็ว ⚡, ยาแห่งโชคดี 🍀, ยาแห่งความกล้า 🦁
Audio Web Audio API:

Correct: cheerful pop sound
Wrong: low buzz
Potion complete: magical fanfare

All text in Thai

🎮 เล่นเกมเลย!

💬 รีวิวจากผู้เล่น (0)

เข้าสู่ระบบ เพื่อเขียนรีวิว
ยังไม่มีรีวิว — เป็นคนแรกที่รีวิวเกมนี้!