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; }); // 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('Ayarlar', { 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('Zorluk Seviyesi:', { size: 90, fill: 0x444444 }); self.difficultyText.anchor.set(0.5, 0.5); self.difficultyText.x = 0; self.difficultyText.y = -250; self.addChild(self.difficultyText); // Easy button var easyButtonBg = self.attachAsset('englishBox', { anchorX: 0.5, anchorY: 0.5 }); easyButtonBg.y = -120; easyButtonBg.x = -400; self.easyButtonText = new Text2('KOLAY', { size: 70, fill: 0xFFFFFF }); self.easyButtonText.anchor.set(0.5, 0.5); self.easyButtonText.x = -400; self.easyButtonText.y = -120; self.addChild(self.easyButtonText); // Medium button var mediumButtonBg = self.attachAsset('englishBox', { anchorX: 0.5, anchorY: 0.5 }); mediumButtonBg.y = -120; mediumButtonBg.x = 0; self.mediumButtonText = new Text2('ORTA', { 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('englishBox', { anchorX: 0.5, anchorY: 0.5 }); hardButtonBg.y = -120; hardButtonBg.x = 400; self.hardButtonText = new Text2('ZOR', { size: 70, fill: 0xFFFFFF }); self.hardButtonText.anchor.set(0.5, 0.5); self.hardButtonText.x = 400; self.hardButtonText.y = -120; self.addChild(self.hardButtonText); // Language section self.languageText = new Text2('Dil:', { 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('LANGUAGE', { 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 = 350; self.backButtonText = new Text2('GERİ', { size: 70, fill: 0xFFFFFF }); self.backButtonText.anchor.set(0.5, 0.5); self.backButtonText.x = 0; self.backButtonText.y = 350; 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 = 0x32cd32; mediumButtonBg.tint = 0x32cd32; hardButtonBg.tint = 0x32cd32; // Highlight selected if (currentDifficulty === 'easy') { easyButtonBg.tint = 0x228b22; } else if (currentDifficulty === 'medium') { mediumButtonBg.tint = 0x228b22; } else if (currentDifficulty === 'hard') { hardButtonBg.tint = 0x228b22; } }; 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) { // Language functionality placeholder console.log('Language button pressed'); } // 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('Turkish Word Match', { size: 120, fill: 0x222222 }); 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('Match Turkish words\nto their English meanings!', { 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('BAŞLA', { 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('AYARLAR', { 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 ****/ // --- Word Data --- // Turkish word box // English word box // Correct match flash // Wrong match flash 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?" }, { tr: "Neden?", en: "Why?" }, { tr: "Anlıyorum", en: "I understand" }, { tr: "Anlamıyorum", en: "I don't understand" }, { tr: "Yardım edebilir misiniz?", en: "Can you help me?" }, { tr: "Özür dilerim", en: "I'm sorry" }, { tr: "Bir dakika", en: "One moment" }, { tr: "Konuşabiliyor musunuz?", en: "Can you speak?" }, { tr: "Tekrar söyleyebilir misiniz?", en: "Can you repeat?" }, { tr: "Çok teşekkür ederim", en: "Thank you very much" }]; // Get word pairs based on difficulty function getWordPairs() { var difficulty = storage.difficulty || 'medium'; 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('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 pairs = []; var used = []; while (pairs.length < numPairs && used.length < currentWordPairs.length) { var idx = Math.floor(Math.random() * currentWordPairs.length); if (used.indexOf(idx) === -1) { pairs.push({ tr: currentWordPairs[idx].tr, en: currentWordPairs[idx].en, 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('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('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('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
@@ -239,17 +239,17 @@
var settingsButtonBg = self.attachAsset('englishBox', {
anchorX: 0.5,
anchorY: 0.5
});
- settingsButtonBg.y = 380;
+ settingsButtonBg.y = 455;
// Settings button text
self.settingsButtonText = new Text2('AYARLAR', {
size: 90,
fill: 0xFFFFFF
});
self.settingsButtonText.anchor.set(0.5, 0.5);
self.settingsButtonText.x = 0;
- self.settingsButtonText.y = 380;
+ 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