得分: 0
速度: 1
Chinese Word Typing Game
得分: 0
速度: 1
basic: ['小姐', '名字', '先生', '什么', '老师', '学生', '中国', '美国', '纽约', '爸爸', '妈妈', '星期', '生日', '今年', '喜欢', '可是', '现在', '明天', '因为', '认识', '朋友', '周末', '打球', '唱歌', '音乐', '所以', '不错', '觉得', '睡觉', '学校', '咖啡', '可以', '回家', '电话', '时间', '问题', '考试', '方便', '以后', '准备', '练习', '说话', '怎么', '容易', '平常', '功课', '开始', '洗澡', '一边', '电脑', '上网', '告诉', '已经', '知道', '东西', '衣服', '多少', '一样', '虽然', '飞机', '紧张', '自己'], intermediate: ['刚才', '暖和', '那么', '好玩儿', '非常', '冬天', '春天', '舒服', '好像', '服务', '点菜', '白菜', '冰茶', '好吃', '米饭', '中心', '听说', '运动', '中间', '一直', '日本', '饮料', '水果', '以为', '聪明', '用功', '长大', '一定', '休息', '再说', '医院', '看病', '发烧', '检查', '打针', '办法', '身体', '印象', '打扫', '整理', '房间', '做饭', '附近', '走路', '安静', '另外', '简单', '当然', '难受', '游泳', '危险', '比赛', '担心', '放假', '打算', '父母', '有名', '打折', '小心'], advanced: ['研究', '安全', '比较', '好处', '自由', '恐怕', '地道', '新鲜', '不如', '比如', '考虑', '主意', '无论', '需要', '价钱', '道理', '标准', '同意', '结果', '世界', '轻松', '讨论', '经济', '决定', '解决', '其实', '建议', '意见', '性格', '爱好', '根本', '心情', '态度', '吵架', '分手', '垃圾', '迟到', '重要', '帮助', '免费', '感觉', '网站', '受到', '教育', '压力', '适合', '家庭', '银行', '设计', '结婚', '厉害', '安排', '反对', '完全', '理解', '看法', '结束', '环境', '自然', '到处'] }; let score = 0; let wordSpeed = 1; let currentWordList = wordLists.basic; const game = document.getElementById('game'); const typedWord = document.getElementById('typed-word'); const submitWord = document.getElementById('submit-word'); const scoreDisplay = document.getElementById('score'); const speedDecrease = document.getElementById('speed-decrease'); const speedIncrease = document.getElementById('speed-increase'); const speedDisplay = document.getElementById('speed-display'); const wordListSelect = document.getElementById('word-list'); function placeWord() { const word = document.createElement('div'); word.textContent = currentWordList[Math.floor(Math.random() * currentWordList.length)]; word.className = 'moving-word'; word.style.left = `${game.offsetWidth}px`; const maxTop = game.offsetHeight - 150; word.style.top = `${Math.random() * maxTop}px`; game.appendChild(word); return word; } function createExplosion(x, y) { const explosion = document.createElement('div'); explosion.className = 'explosion'; explosion.style.left = `${x}px`; explosion.style.top = `${y}px`; game.appendChild(explosion); setTimeout(() => explosion.remove(), 500); } function checkInput() { const input = typedWord.value.trim(); const words = Array.from(document.querySelectorAll('.moving-word')); const matchedWord = words.find(word => word.textContent === input); if (matchedWord) { score += 100; scoreDisplay.textContent = score; const rect = matchedWord.getBoundingClientRect(); createExplosion(rect.left + rect.width / 2, rect.top + rect.height / 2); matchedWord.remove(); } typedWord.value = ''; } function gameLoop() { const words = Array.from(document.querySelectorAll('.moving-word')); words.forEach((word) => { const currentLeft = parseFloat(word.style.left); word.style.left = `${currentLeft - wordSpeed}px`; if (currentLeft < -word.offsetWidth) { word.remove(); } }); if (words.length < 3 && Math.random() < 0.02) { placeWord(); } requestAnimationFrame(gameLoop); } document.addEventListener('keydown', (e) => { if (e.key === 'Enter') { checkInput(); e.preventDefault(); } }); submitWord.addEventListener('click', checkInput); speedDecrease.addEventListener('click', () => { if (wordSpeed > 0.5) { wordSpeed -= 0.5; speedDisplay.textContent = wordSpeed; } }); speedIncrease.addEventListener('click', () => { if (wordSpeed < 5) { wordSpeed += 0.5; speedDisplay.textContent = wordSpeed; } }); wordListSelect.addEventListener('change', (e) => { currentWordList = wordLists[e.target.value]; game.innerHTML = ''; placeWord(); placeWord(); }); gameLoop(); placeWord(); placeWord();