User prompt
Zorluk Seviyesi yazısını biraz yukarı alırmısın
User prompt
Kolay orta ve zor butonlarını asset olarak eklermisin
User prompt
Orta butonunu sarı ve zor butonunu kırmızı yaparmısın
User prompt
Kolay orta ve zor butonlarının birbirine geçmemesi gerekmektedir yani butonların arasına boşluk bırakırmısın
User prompt
İlk ekrandaki “Turkish Word Match” yazısının fontunu azcık kalınlaştır ve daha güzel yap
User prompt
Arayüz dili seçildiği anda uygulanmalıdır ve oyuna ilk girildiğine tüm dil seçenekleri ingilizce olmalıdır ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Arayüz dili seçildiğinde seçilen dilde olmalıdır oyun (eşleştirme kısmı hariç) ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Language kısmında ekranın sağ köşesinde arayüz dili yazısı olmalı ve altında ispanyolca,ingilizce ve türkçe olmalı bu seçeneklerden hangisine basılırsa seçilen dilde arayüz yap (tüm butonların arasına 1 cm aralık bırak) sol kısmında oyun dili yazısı olmalı oranın altında ingilizce ve ispanyolca seçenekleri olmalıdır (tüm butonların arasına 1 cm aralık bırakılmalıdır) hangi dil seçilirse oyunda olur englishBox o dilde olmalıdır ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Geri butonunu 75 pixel aşağı indir
User prompt
Ayarlar butonunu 1 cm aşağı indirirmisin Lütfeb
User prompt
Ayarlar butonunu çok az aşağı indirirmisin
User prompt
Butonların arasına çok az aralık bırakırmısın
User prompt
Başla seçeneğinin altına ayarlar ve ayatlar kısmının altına "Language" düğmesi eklermisin ayarlar kısmında: zorluk seçilmeli kolay orta zor olarak üç büton olmalı ve bu butonlara göre oyunun zorluğu belirlenmelidir zor seçen bir kişiye daha zor kelimeler sorulmalı ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Başlangıç ekranı yap
User prompt
Türkçe kutular yanlış yapıldığında kendi konumuna dönmeli
User prompt
Her yanlış yaptığımızda score 1 eksilmeli
Code edit (1 edits merged)
Please save this source code
User prompt
If the player has not matched all the boxes, the next level cannot be passed (whenever he matches all the boxes, then he can pass)
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ // EnglishWordBox: static target var EnglishWordBox = Container.expand(function () { var self = Container.call(this); // Attach box var box = self.attachAsset('englishBox', { anchorX: 0.5, anchorY: 0.5 }); // Attach text self.textObj = new Text2('', { size: 80, fill: 0xFFFFFF }); self.textObj.anchor.set(0.5, 0.5); self.addChild(self.textObj); // Store word self.word = ''; self.matchId = ''; // Set word and match id self.setWord = function (word, matchId) { self.word = word; self.matchId = matchId; self.textObj.setText(word); }; return self; }); // LanguageScreen: shows interface and game language options var LanguageScreen = Container.expand(function () { var self = Container.call(this); // Background var bg = self.attachAsset('flashCorrect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9 }); // Title self.titleText = new Text2(getInterfaceText('languageScreenTitle'), { size: 120, fill: 0x222222 }); self.titleText.anchor.set(0.5, 0.5); self.titleText.x = 0; self.titleText.y = -400; self.addChild(self.titleText); // Interface Language Section (Right side) self.interfaceText = new Text2(getInterfaceText('interfaceLanguage'), { size: 90, fill: 0x444444 }); self.interfaceText.anchor.set(0.5, 0.5); self.interfaceText.x = 650; self.interfaceText.y = -250; self.addChild(self.interfaceText); // Interface Turkish button var interfaceTurkishBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); interfaceTurkishBg.y = -120; interfaceTurkishBg.x = 650; self.interfaceTurkishText = new Text2('TÜRKÇE', { size: 70, fill: 0xFFFFFF }); self.interfaceTurkishText.anchor.set(0.5, 0.5); self.interfaceTurkishText.x = 650; self.interfaceTurkishText.y = -120; self.addChild(self.interfaceTurkishText); // Interface English button var interfaceEnglishBg = self.attachAsset('englishBox', { anchorX: 0.5, anchorY: 0.5 }); interfaceEnglishBg.y = 55; interfaceEnglishBg.x = 650; self.interfaceEnglishText = new Text2('ENGLISH', { size: 70, fill: 0xFFFFFF }); self.interfaceEnglishText.anchor.set(0.5, 0.5); self.interfaceEnglishText.x = 650; self.interfaceEnglishText.y = 55; self.addChild(self.interfaceEnglishText); // Interface Spanish button var interfaceSpanishBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); interfaceSpanishBg.y = 230; interfaceSpanishBg.x = 650; self.interfaceSpanishText = new Text2('ESPAÑOL', { size: 70, fill: 0xFFFFFF }); self.interfaceSpanishText.anchor.set(0.5, 0.5); self.interfaceSpanishText.x = 650; self.interfaceSpanishText.y = 230; self.addChild(self.interfaceSpanishText); // Game Language Section (Left side) self.gameLanguageText = new Text2(getInterfaceText('gameLanguage'), { size: 90, fill: 0x444444 }); self.gameLanguageText.anchor.set(0.5, 0.5); self.gameLanguageText.x = -450; self.gameLanguageText.y = -250; self.addChild(self.gameLanguageText); // Game English button var gameEnglishBg = self.attachAsset('englishBox', { anchorX: 0.5, anchorY: 0.5 }); gameEnglishBg.y = -120; gameEnglishBg.x = -450; self.gameEnglishText = new Text2('ENGLISH', { size: 70, fill: 0xFFFFFF }); self.gameEnglishText.anchor.set(0.5, 0.5); self.gameEnglishText.x = -450; self.gameEnglishText.y = -120; self.addChild(self.gameEnglishText); // Game Spanish button var gameSpanishBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); gameSpanishBg.y = 55; gameSpanishBg.x = -450; self.gameSpanishText = new Text2('ESPAÑOL', { size: 70, fill: 0xFFFFFF }); self.gameSpanishText.anchor.set(0.5, 0.5); self.gameSpanishText.x = -450; self.gameSpanishText.y = 55; self.addChild(self.gameSpanishText); // Back button var backButtonBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); backButtonBg.y = 425; self.backButtonText = new Text2(getInterfaceText('back'), { size: 70, fill: 0xFFFFFF }); self.backButtonText.anchor.set(0.5, 0.5); self.backButtonText.x = 0; self.backButtonText.y = 425; self.addChild(self.backButtonText); // Update button colors based on current selections self.updateLanguageButtons = function () { var interfaceLang = storage.interfaceLanguage || 'turkish'; var gameLang = storage.gameLanguage || 'english'; // Reset all to default color interfaceTurkishBg.tint = 0x1e90ff; interfaceEnglishBg.tint = 0x32cd32; interfaceSpanishBg.tint = 0x1e90ff; gameEnglishBg.tint = 0x32cd32; gameSpanishBg.tint = 0x1e90ff; // Highlight selected interface language if (interfaceLang === 'turkish') { interfaceTurkishBg.tint = 0x1565c0; } else if (interfaceLang === 'english') { interfaceEnglishBg.tint = 0x228b22; } else if (interfaceLang === 'spanish') { interfaceSpanishBg.tint = 0x1565c0; } // Highlight selected game language if (gameLang === 'english') { gameEnglishBg.tint = 0x228b22; } else if (gameLang === 'spanish') { gameSpanishBg.tint = 0x1565c0; } }; // Method to update all interface texts self.updateInterfaceTexts = function () { self.titleText.setText(getInterfaceText('languageScreenTitle')); self.interfaceText.setText(getInterfaceText('interfaceLanguage')); self.gameLanguageText.setText(getInterfaceText('gameLanguage')); self.backButtonText.setText(getInterfaceText('back')); }; self.updateLanguageButtons(); // Touch handler self.down = function (x, y, obj) { // Interface Turkish button if (x >= interfaceTurkishBg.x - interfaceTurkishBg.width / 2 && x <= interfaceTurkishBg.x + interfaceTurkishBg.width / 2 && y >= interfaceTurkishBg.y - interfaceTurkishBg.height / 2 && y <= interfaceTurkishBg.y + interfaceTurkishBg.height / 2) { storage.interfaceLanguage = 'turkish'; self.updateLanguageButtons(); self.updateInterfaceTexts(); updateAllInterfaceTexts(); } // Interface English button else if (x >= interfaceEnglishBg.x - interfaceEnglishBg.width / 2 && x <= interfaceEnglishBg.x + interfaceEnglishBg.width / 2 && y >= interfaceEnglishBg.y - interfaceEnglishBg.height / 2 && y <= interfaceEnglishBg.y + interfaceEnglishBg.height / 2) { storage.interfaceLanguage = 'english'; self.updateLanguageButtons(); self.updateInterfaceTexts(); updateAllInterfaceTexts(); } // Interface Spanish button else if (x >= interfaceSpanishBg.x - interfaceSpanishBg.width / 2 && x <= interfaceSpanishBg.x + interfaceSpanishBg.width / 2 && y >= interfaceSpanishBg.y - interfaceSpanishBg.height / 2 && y <= interfaceSpanishBg.y + interfaceSpanishBg.height / 2) { storage.interfaceLanguage = 'spanish'; self.updateLanguageButtons(); self.updateInterfaceTexts(); updateAllInterfaceTexts(); } // Game English button else if (x >= gameEnglishBg.x - gameEnglishBg.width / 2 && x <= gameEnglishBg.x + gameEnglishBg.width / 2 && y >= gameEnglishBg.y - gameEnglishBg.height / 2 && y <= gameEnglishBg.y + gameEnglishBg.height / 2) { storage.gameLanguage = 'english'; self.updateLanguageButtons(); } // Game Spanish button else if (x >= gameSpanishBg.x - gameSpanishBg.width / 2 && x <= gameSpanishBg.x + gameSpanishBg.width / 2 && y >= gameSpanishBg.y - gameSpanishBg.height / 2 && y <= gameSpanishBg.y + gameSpanishBg.height / 2) { storage.gameLanguage = 'spanish'; self.updateLanguageButtons(); } // Back button else if (x >= backButtonBg.x - backButtonBg.width / 2 && x <= backButtonBg.x + backButtonBg.width / 2 && y >= backButtonBg.y - backButtonBg.height / 2 && y <= backButtonBg.y + backButtonBg.height / 2) { // Go back to settings screen self.destroy(); var settingsScreen = new SettingsScreen(); settingsScreen.x = 2048 / 2; settingsScreen.y = 2732 / 2; game.addChild(settingsScreen); } }; return self; }); // SettingsScreen: shows difficulty and language options var SettingsScreen = Container.expand(function () { var self = Container.call(this); // Background var bg = self.attachAsset('flashCorrect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9 }); // Title self.titleText = new Text2(getInterfaceText('settingsTitle'), { size: 120, fill: 0x222222 }); self.titleText.anchor.set(0.5, 0.5); self.titleText.x = 0; self.titleText.y = -400; self.addChild(self.titleText); // Difficulty section self.difficultyText = new Text2(getInterfaceText('difficulty'), { size: 90, fill: 0x444444 }); self.difficultyText.anchor.set(0.5, 0.5); self.difficultyText.x = 0; self.difficultyText.y = -300; self.addChild(self.difficultyText); // Easy button var easyButtonBg = self.attachAsset('easyButton', { anchorX: 0.5, anchorY: 0.5 }); easyButtonBg.y = -120; easyButtonBg.x = -500; self.easyButtonText = new Text2(getInterfaceText('easy'), { size: 70, fill: 0xFFFFFF }); self.easyButtonText.anchor.set(0.5, 0.5); self.easyButtonText.x = -500; self.easyButtonText.y = -120; self.addChild(self.easyButtonText); // Medium button var mediumButtonBg = self.attachAsset('mediumButton', { anchorX: 0.5, anchorY: 0.5 }); mediumButtonBg.y = -120; mediumButtonBg.x = 0; self.mediumButtonText = new Text2(getInterfaceText('medium'), { size: 70, fill: 0xFFFFFF }); self.mediumButtonText.anchor.set(0.5, 0.5); self.mediumButtonText.x = 0; self.mediumButtonText.y = -120; self.addChild(self.mediumButtonText); // Hard button var hardButtonBg = self.attachAsset('hardButton', { anchorX: 0.5, anchorY: 0.5 }); hardButtonBg.y = -120; hardButtonBg.x = 500; self.hardButtonText = new Text2(getInterfaceText('hard'), { size: 70, fill: 0xFFFFFF }); self.hardButtonText.anchor.set(0.5, 0.5); self.hardButtonText.x = 500; self.hardButtonText.y = -120; self.addChild(self.hardButtonText); // Language section self.languageText = new Text2(getInterfaceText('language'), { size: 90, fill: 0x444444 }); self.languageText.anchor.set(0.5, 0.5); self.languageText.x = 0; self.languageText.y = 50; self.addChild(self.languageText); // Language button var languageButtonBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); languageButtonBg.y = 180; self.languageButtonText = new Text2(getInterfaceText('languageButton'), { size: 70, fill: 0xFFFFFF }); self.languageButtonText.anchor.set(0.5, 0.5); self.languageButtonText.x = 0; self.languageButtonText.y = 180; self.addChild(self.languageButtonText); // Back button var backButtonBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); backButtonBg.y = 425; self.backButtonText = new Text2(getInterfaceText('back'), { size: 70, fill: 0xFFFFFF }); self.backButtonText.anchor.set(0.5, 0.5); self.backButtonText.x = 0; self.backButtonText.y = 425; self.addChild(self.backButtonText); // Update button colors based on current difficulty self.updateDifficultyButtons = function () { var currentDifficulty = storage.difficulty || 'medium'; // Reset all to default color easyButtonBg.tint = 0xFFFFFF; mediumButtonBg.tint = 0xFFFFFF; hardButtonBg.tint = 0xFFFFFF; // Highlight selected if (currentDifficulty === 'easy') { easyButtonBg.tint = 0x228b22; } else if (currentDifficulty === 'medium') { mediumButtonBg.tint = 0xB8860B; } else if (currentDifficulty === 'hard') { hardButtonBg.tint = 0xCC0000; } }; self.updateDifficultyButtons(); // Touch handler self.down = function (x, y, obj) { // Easy button if (x >= easyButtonBg.x - easyButtonBg.width / 2 && x <= easyButtonBg.x + easyButtonBg.width / 2 && y >= easyButtonBg.y - easyButtonBg.height / 2 && y <= easyButtonBg.y + easyButtonBg.height / 2) { storage.difficulty = 'easy'; self.updateDifficultyButtons(); } // Medium button else if (x >= mediumButtonBg.x - mediumButtonBg.width / 2 && x <= mediumButtonBg.x + mediumButtonBg.width / 2 && y >= mediumButtonBg.y - mediumButtonBg.height / 2 && y <= mediumButtonBg.y + mediumButtonBg.height / 2) { storage.difficulty = 'medium'; self.updateDifficultyButtons(); } // Hard button else if (x >= hardButtonBg.x - hardButtonBg.width / 2 && x <= hardButtonBg.x + hardButtonBg.width / 2 && y >= hardButtonBg.y - hardButtonBg.height / 2 && y <= hardButtonBg.y + hardButtonBg.height / 2) { storage.difficulty = 'hard'; self.updateDifficultyButtons(); } // Language button else if (x >= languageButtonBg.x - languageButtonBg.width / 2 && x <= languageButtonBg.x + languageButtonBg.width / 2 && y >= languageButtonBg.y - languageButtonBg.height / 2 && y <= languageButtonBg.y + languageButtonBg.height / 2) { // Show language screen self.destroy(); var languageScreen = new LanguageScreen(); languageScreen.x = 2048 / 2; languageScreen.y = 2732 / 2; game.addChild(languageScreen); } // Back button else if (x >= backButtonBg.x - backButtonBg.width / 2 && x <= backButtonBg.x + backButtonBg.width / 2 && y >= backButtonBg.y - backButtonBg.height / 2 && y <= backButtonBg.y + backButtonBg.height / 2) { // Go back to start screen self.destroy(); startScreen = new StartScreen(); startScreen.x = 2048 / 2; startScreen.y = 2732 / 2; game.addChild(startScreen); } }; return self; }); // StartScreen: shows game intro and start button var StartScreen = Container.expand(function () { var self = Container.call(this); // Background var bg = self.attachAsset('flashCorrect', { anchorX: 0.5, anchorY: 0.5, alpha: 0.9 }); // Title self.titleText = new Text2(getInterfaceText('title'), { size: 120, fill: 0x222222, font: "'GillSans-Bold',Impact,'Arial Black',Tahoma" }); self.titleText.anchor.set(0.5, 0.5); self.titleText.x = 0; self.titleText.y = -300; self.addChild(self.titleText); // Instructions self.instructionText = new Text2(getInterfaceText('instructions'), { size: 80, fill: 0x444444 }); self.instructionText.anchor.set(0.5, 0.5); self.instructionText.x = 0; self.instructionText.y = -100; self.addChild(self.instructionText); // Start button background var startButtonBg = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); startButtonBg.y = 200; // Start button text self.startButtonText = new Text2(getInterfaceText('start'), { size: 90, fill: 0xFFFFFF }); self.startButtonText.anchor.set(0.5, 0.5); self.startButtonText.x = 0; self.startButtonText.y = 200; self.addChild(self.startButtonText); // Settings button background var settingsButtonBg = self.attachAsset('englishBox', { anchorX: 0.5, anchorY: 0.5 }); settingsButtonBg.y = 455; // Settings button text self.settingsButtonText = new Text2(getInterfaceText('settings'), { size: 90, fill: 0xFFFFFF }); self.settingsButtonText.anchor.set(0.5, 0.5); self.settingsButtonText.x = 0; self.settingsButtonText.y = 455; self.addChild(self.settingsButtonText); // Touch handler for start button self.down = function (x, y, obj) { // Check if clicked on start button area var buttonX = startButtonBg.x; var buttonY = startButtonBg.y; var buttonW = startButtonBg.width; var buttonH = startButtonBg.height; if (x >= buttonX - buttonW / 2 && x <= buttonX + buttonW / 2 && y >= buttonY - buttonH / 2 && y <= buttonY + buttonH / 2) { // Start the game self.destroy(); startRound(); } // Check if clicked on settings button area else if (x >= settingsButtonBg.x - settingsButtonBg.width / 2 && x <= settingsButtonBg.x + settingsButtonBg.width / 2 && y >= settingsButtonBg.y - settingsButtonBg.height / 2 && y <= settingsButtonBg.y + settingsButtonBg.height / 2) { // Show settings screen self.destroy(); var settingsScreen = new SettingsScreen(); settingsScreen.x = 2048 / 2; settingsScreen.y = 2732 / 2; game.addChild(settingsScreen); } }; return self; }); // TurkishWordBox: draggable Turkish word var TurkishWordBox = Container.expand(function () { var self = Container.call(this); // Attach box var box = self.attachAsset('turkishBox', { anchorX: 0.5, anchorY: 0.5 }); // Attach text self.textObj = new Text2('', { size: 80, fill: 0xFFFFFF }); self.textObj.anchor.set(0.5, 0.5); self.addChild(self.textObj); // Store word self.word = ''; self.matchId = ''; // Drag state self.isDragging = false; // Set word and match id self.setWord = function (word, matchId) { self.word = word; self.matchId = matchId; self.textObj.setText(word); }; // For drag offset self.dragOffsetX = 0; self.dragOffsetY = 0; // Down event: start drag self.down = function (x, y, obj) { self.isDragging = true; // Offset from center self.dragOffsetX = self.x - x; self.dragOffsetY = self.y - y; dragNode = self; }; // Up event: handled in game.up return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xf7f7f7 }); /**** * Game Code ****/ // Wrong match flash // Correct match flash // English word box // Turkish word box // --- Interface Language Translations --- var interfaceTranslations = { turkish: { title: 'Turkish Word Match', instructions: 'Türkçe kelimeleri\nİngilizce karşılıklarıyla eşleştirin!', start: 'BAŞLA', settings: 'AYARLAR', back: 'GERİ', settingsTitle: 'Ayarlar', difficulty: 'Zorluk Seviyesi:', easy: 'KOLAY', medium: 'ORTA', hard: 'ZOR', language: 'Dil:', languageButton: 'LANGUAGE', languageScreenTitle: 'Dil Ayarları', interfaceLanguage: 'Arayüz Dili:', gameLanguage: 'Oyun Dili:', score: 'Skor: ' }, english: { title: 'Turkish Word Match', instructions: 'Match Turkish words\nto their English meanings!', start: 'START', settings: 'SETTINGS', back: 'BACK', settingsTitle: 'Settings', difficulty: 'Difficulty Level:', easy: 'EASY', medium: 'MEDIUM', hard: 'HARD', language: 'Language:', languageButton: 'LANGUAGE', languageScreenTitle: 'Language Settings', interfaceLanguage: 'Interface Language:', gameLanguage: 'Game Language:', score: 'Score: ' }, spanish: { title: 'Turkish Word Match', instructions: 'Empareja palabras turcas\ncon sus significados!', start: 'EMPEZAR', settings: 'CONFIGURACIÓN', back: 'VOLVER', settingsTitle: 'Configuración', difficulty: 'Nivel de Dificultad:', easy: 'FÁCIL', medium: 'MEDIO', hard: 'DIFÍCIL', language: 'Idioma:', languageButton: 'IDIOMA', languageScreenTitle: 'Configuración de Idioma', interfaceLanguage: 'Idioma de Interfaz:', gameLanguage: 'Idioma del Juego:', score: 'Puntuación: ' } }; // Function to get current interface language text function getInterfaceText(key) { var interfaceLang = storage.interfaceLanguage || 'english'; return interfaceTranslations[interfaceLang][key] || interfaceTranslations.english[key]; } // Function to update all interface texts function updateAllInterfaceTexts() { // Update score text scoreText.setText(getInterfaceText('score') + score); } // --- Word Data --- var easyWordPairs = [{ tr: "Merhaba", en: "Hello" }, { tr: "Evet", en: "Yes" }, { tr: "Hayır", en: "No" }, { tr: "Teşekkürler", en: "Thank you" }, { tr: "İyi", en: "Good" }, { tr: "Kötü", en: "Bad" }, { tr: "Tamam", en: "Okay" }, { tr: "Güle güle", en: "Goodbye" }]; var mediumWordPairs = [{ tr: "Günaydın", en: "Good morning" }, { tr: "Lütfen", en: "Please" }, { tr: "Nasılsın?", en: "How are you?" }, { tr: "Affedersiniz", en: "Excuse me" }, { tr: "Hoş geldiniz", en: "Welcome" }, { tr: "Hoşça kal", en: "Bye" }, { tr: "Benim adım...", en: "My name is..." }, { tr: "Ne?", en: "What?" }, { tr: "Kim?", en: "Who?" }, { tr: "Nerede?", en: "Where?" }]; var hardWordPairs = [{ tr: "Ne zaman?", en: "When?", es: "¿Cuándo?" }, { tr: "Neden?", en: "Why?", es: "¿Por qué?" }, { tr: "Anlıyorum", en: "I understand", es: "Entiendo" }, { tr: "Anlamıyorum", en: "I don't understand", es: "No entiendo" }, { tr: "Yardım edebilir misiniz?", en: "Can you help me?", es: "¿Puedes ayudarme?" }, { tr: "Özür dilerim", en: "I'm sorry", es: "Lo siento" }, { tr: "Bir dakika", en: "One moment", es: "Un momento" }, { tr: "Konuşabiliyor musunuz?", en: "Can you speak?", es: "¿Puedes hablar?" }, { tr: "Tekrar söyleyebilir misiniz?", en: "Can you repeat?", es: "¿Puedes repetir?" }, { tr: "Çok teşekkür ederim", en: "Thank you very much", es: "Muchas gracias" }]; var easyWordPairsSpanish = [{ tr: "Merhaba", es: "Hola" }, { tr: "Evet", es: "Sí" }, { tr: "Hayır", es: "No" }, { tr: "Teşekkürler", es: "Gracias" }, { tr: "İyi", es: "Bueno" }, { tr: "Kötü", es: "Malo" }, { tr: "Tamam", es: "Okay" }, { tr: "Güle güle", es: "Adiós" }]; var mediumWordPairsSpanish = [{ tr: "Günaydın", es: "Buenos días" }, { tr: "Lütfen", es: "Por favor" }, { tr: "Nasılsın?", es: "¿Cómo estás?" }, { tr: "Affedersiniz", es: "Perdón" }, { tr: "Hoş geldiniz", es: "Bienvenido" }, { tr: "Hoşça kal", es: "Hasta luego" }, { tr: "Benim adım...", es: "Mi nombre es..." }, { tr: "Ne?", es: "¿Qué?" }, { tr: "Kim?", es: "¿Quién?" }, { tr: "Nerede?", es: "¿Dónde?" }]; var hardWordPairsSpanish = [{ tr: "Ne zaman?", es: "¿Cuándo?" }, { tr: "Neden?", es: "¿Por qué?" }, { tr: "Anlıyorum", es: "Entiendo" }, { tr: "Anlamıyorum", es: "No entiendo" }, { tr: "Yardım edebilir misiniz?", es: "¿Puedes ayudarme?" }, { tr: "Özür dilerim", es: "Lo siento" }, { tr: "Bir dakika", es: "Un momento" }, { tr: "Konuşabiliyor musunuz?", es: "¿Puedes hablar?" }, { tr: "Tekrar söyleyebilir misiniz?", es: "¿Puedes repetir?" }, { tr: "Çok teşekkür ederim", es: "Muchas gracias" }]; // Get word pairs based on difficulty function getWordPairs() { var difficulty = storage.difficulty || 'medium'; var gameLanguage = storage.gameLanguage || 'english'; if (gameLanguage === 'spanish') { if (difficulty === 'easy') { return easyWordPairsSpanish; } else if (difficulty === 'hard') { return hardWordPairsSpanish; } else { return mediumWordPairsSpanish; } } else { if (difficulty === 'easy') { return easyWordPairs; } else if (difficulty === 'hard') { return hardWordPairs; } else { return mediumWordPairs; } } } // --- Game State --- var currentRound = 0; var score = 0; var timeLeft = 15; // seconds per round, will decrease var roundTimer = null; var timerText = null; var scoreText = null; var dragNode = null; var turkishBoxes = []; var englishBoxes = []; var matchCount = 0; var roundActive = false; var lastFlash = null; var gameStarted = false; var startScreen = null; // --- UI Setup --- // Score display scoreText = new Text2(getInterfaceText('score') + '0', { size: 90, fill: 0x222222 }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); // Timer display timerText = new Text2('15', { size: 90, fill: 0xD83318 }); timerText.anchor.set(1, 0); LK.gui.topRight.addChild(timerText); // --- Game Functions --- function shuffleArray(arr) { // Fisher-Yates shuffle for (var i = arr.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } return arr; } function startRound() { // Clean up previous round for (var i = 0; i < turkishBoxes.length; i++) { turkishBoxes[i].destroy(); } for (var i = 0; i < englishBoxes.length; i++) { englishBoxes[i].destroy(); } turkishBoxes = []; englishBoxes = []; matchCount = 0; dragNode = null; roundActive = true; gameStarted = true; // Increase difficulty: more pairs, less time var numPairs = 2 + Math.floor(currentRound / 2); if (numPairs > 6) { numPairs = 6; } timeLeft = 15 - currentRound * 1; if (timeLeft < 6) { timeLeft = 6; } // Pick random pairs based on difficulty var currentWordPairs = getWordPairs(); var gameLanguage = storage.gameLanguage || 'english'; var pairs = []; var used = []; while (pairs.length < numPairs && used.length < currentWordPairs.length) { var idx = Math.floor(Math.random() * currentWordPairs.length); if (used.indexOf(idx) === -1) { var targetWord = gameLanguage === 'spanish' ? currentWordPairs[idx].es : currentWordPairs[idx].en; pairs.push({ tr: currentWordPairs[idx].tr, en: targetWord, id: 'pair' + idx }); used.push(idx); } } // Shuffle Turkish and English sides separately var turkishList = []; var englishList = []; for (var i = 0; i < pairs.length; i++) { turkishList.push({ word: pairs[i].tr, id: pairs[i].id }); englishList.push({ word: pairs[i].en, id: pairs[i].id }); } shuffleArray(turkishList); shuffleArray(englishList); // Layout Turkish boxes (draggable) on left var spacingY = 220; var startY = (2732 - (turkishList.length * spacingY - (spacingY - 180))) / 2; for (var i = 0; i < turkishList.length; i++) { var box = new TurkishWordBox(); box.setWord(turkishList[i].word, turkishList[i].id); box.x = 400; box.y = startY + i * spacingY; // Store initial position for snap-back box.initialX = box.x; box.initialY = box.y; turkishBoxes.push(box); game.addChild(box); } // Layout English boxes (targets) on right for (var i = 0; i < englishList.length; i++) { var box = new EnglishWordBox(); box.setWord(englishList[i].word, englishList[i].id); box.x = 2048 - 400; box.y = startY + i * spacingY; englishBoxes.push(box); game.addChild(box); } // Start timer timerText.setText(timeLeft); if (roundTimer) { LK.clearInterval(roundTimer); } roundTimer = LK.setInterval(function () { if (!roundActive) { return; } timeLeft -= 1; timerText.setText(timeLeft); if (timeLeft <= 0) { endRound(false); } }, 1000); } function endRound(success) { roundActive = false; if (roundTimer) { LK.clearInterval(roundTimer); roundTimer = null; } // Flash feedback if (success) { LK.effects.flashScreen(0x83de44, 600); } else { LK.effects.flashScreen(0xff0000, 900); } // Next round or game over LK.setTimeout(function () { if (success) { currentRound += 1; if (currentRound >= 10) { LK.showYouWin(); } else { startRound(); } } else { LK.showGameOver(); } }, 900); } function checkMatch(turkishBox, englishBox) { if (!roundActive) { return; } if (turkishBox.matchId === englishBox.matchId) { // Correct score += 1; LK.setScore(score); scoreText.setText(getInterfaceText('score') + score); // Animate to target tween(turkishBox, { x: englishBox.x, y: englishBox.y }, { duration: 250, easing: tween.easeIn, onFinish: function onFinish() { turkishBox.destroy(); englishBox.destroy(); } }); // Remove from arrays for (var i = 0; i < turkishBoxes.length; i++) { if (turkishBoxes[i] === turkishBox) { turkishBoxes.splice(i, 1); break; } } for (var i = 0; i < englishBoxes.length; i++) { if (englishBoxes[i] === englishBox) { englishBoxes.splice(i, 1); break; } } matchCount += 1; LK.effects.flashObject(turkishBox, 0x83de44, 400); // Only pass if all Turkish and English boxes are matched (arrays are empty) if (turkishBoxes.length === 0 && englishBoxes.length === 0) { endRound(true); } } else { // Wrong score -= 1; if (score < 0) score = 0; LK.setScore(score); scoreText.setText(getInterfaceText('score') + score); LK.effects.flashObject(turkishBox, 0xff0000, 400); // Snap back tween(turkishBox, { x: typeof turkishBox.initialX !== "undefined" ? turkishBox.initialX : 400, y: typeof turkishBox.initialY !== "undefined" ? turkishBox.initialY : turkishBox.y }, { duration: 200, easing: tween.easeOut }); } } // --- Drag and Drop Logic --- function handleMove(x, y, obj) { if (!gameStarted || !roundActive) { return; } if (dragNode && dragNode.isDragging) { // Move Turkish box to where player touches (centered) dragNode.x = x; dragNode.y = y; } } game.move = handleMove; game.down = function (x, y, obj) { if (!gameStarted || !roundActive) { return; } // Check if a Turkish box is pressed for (var i = 0; i < turkishBoxes.length; i++) { var box = turkishBoxes[i]; // Check bounds var bx = box.x - box.width / 2; var by = box.y - box.height / 2; if (x >= bx && x <= bx + box.width && y >= by && y <= by + box.height) { // Start drag box.down(x, y, obj); break; } } }; game.up = function (x, y, obj) { if (!gameStarted || !roundActive) { return; } if (dragNode && dragNode.isDragging) { // Check if over any English box var dropped = false; for (var i = 0; i < englishBoxes.length; i++) { var target = englishBoxes[i]; if (dragNode.intersects(target)) { checkMatch(dragNode, target); dropped = true; break; } } if (!dropped) { // Check for nesting with other Turkish boxes var nested = false; for (var i = 0; i < turkishBoxes.length; i++) { var other = turkishBoxes[i]; if (other !== dragNode && dragNode.intersects(other)) { nested = true; break; } } if (nested) { // Find a free Y position (not overlapping others) var spacingY = 220; var startY = (2732 - (turkishBoxes.length * spacingY - (spacingY - 180))) / 2; var found = false; for (var tryI = 0; tryI < 20 && !found; tryI++) { var tryY = startY + Math.floor(Math.random() * turkishBoxes.length) * spacingY; var overlap = false; for (var j = 0; j < turkishBoxes.length; j++) { var otherBox = turkishBoxes[j]; if (otherBox !== dragNode) { var dy = Math.abs(otherBox.y - tryY); if (dy < 180) { // box height overlap = true; break; } } } if (!overlap) { found = true; tween(dragNode, { x: 400, y: tryY }, { duration: 200, easing: tween.easeOut }); } } if (!found) { // fallback: snap to default tween(dragNode, { x: 400 }, { duration: 200, easing: tween.easeOut }); } } else { // Snap back tween(dragNode, { x: typeof dragNode.initialX !== "undefined" ? dragNode.initialX : 400, y: typeof dragNode.initialY !== "undefined" ? dragNode.initialY : dragNode.y }, { duration: 200, easing: tween.easeOut }); } } dragNode.isDragging = false; dragNode = null; } }; // --- Game Update --- game.update = function () { // No per-frame logic needed for now }; // --- Start Game --- currentRound = 0; score = 0; LK.setScore(0); scoreText.setText(getInterfaceText('score') + '0'); // Show start screen instead of immediately starting startScreen = new StartScreen(); startScreen.x = 2048 / 2; startScreen.y = 2732 / 2; game.addChild(startScreen);
===================================================================
--- original.js
+++ change.js
@@ -260,9 +260,9 @@
fill: 0x444444
});
self.difficultyText.anchor.set(0.5, 0.5);
self.difficultyText.x = 0;
- self.difficultyText.y = -250;
+ self.difficultyText.y = -300;
self.addChild(self.difficultyText);
// Easy button
var easyButtonBg = self.attachAsset('easyButton', {
anchorX: 0.5,