/****
* Plugins
****/
var storage = LK.import("@upit/storage.v1");
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var AnswerSlot = Container.expand(function (index) {
var self = Container.call(this);
var bg = self.attachAsset('answerBox', {
anchorX: 0.5,
anchorY: 0.5
});
self.index = index;
self.occupiedLetter = null;
return self;
});
var CategoryButton = Container.expand(function (category) {
var self = Container.call(this);
var bg = self.attachAsset('categoryButton', {
anchorX: 0.5,
anchorY: 0.5
});
// Set background color based on category
if (category === 'Cars') {
bg.tint = 0x000000; // Black background for Cars (Arabalar)
} else if (category === 'Food') {
bg.tint = 0xFF0000; // Red background for Food (Yemekler)
} else if (category === 'Football') {
bg.tint = 0x00FF00; // Green background for Football (Futbol)
} else if (category === 'Footballers') {
bg.tint = 0x0000FF; // Blue background for Footballers (Futbolcu)
} else if (category === 'Flags') {
bg.tint = 0xFF00FF; // Magenta background for Flags (Bayraqlar)
} else if (category === 'Games') {
bg.tint = 0x800080; // Purple background for Games (Oyunlar)
}
var text = new Text2(category, {
size: 80,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.category = category;
self.down = function (x, y, obj) {
self.scaleX = 0.95;
self.scaleY = 0.95;
showCategoryLogos(self.category);
};
self.up = function (x, y, obj) {
self.scaleX = 1;
self.scaleY = 1;
};
return self;
});
var ExitButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('exitButton', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2('Exit', {
size: 50,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.down = function (x, y, obj) {
self.scaleX = 0.95;
self.scaleY = 0.95;
showCategoryLogos(currentCategory);
};
self.up = function (x, y, obj) {
self.scaleX = 1;
self.scaleY = 1;
};
return self;
});
var HintButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('hintButton', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2('Hint (3 coins)', {
size: 50,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.down = function (x, y, obj) {
if (goldCoins >= 5) {
useHint();
}
};
return self;
});
var LetterTile = Container.expand(function (letter) {
var self = Container.call(this);
var bg = self.attachAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2(letter, {
size: 60,
fill: 0x333333
});
text.anchor.set(0.5, 0.5);
// Ensure text is visible and properly positioned
text.x = 0;
text.y = 0;
text.alpha = 1;
text.visible = true;
self.addChild(text);
self.letter = letter;
self.originalX = 0;
self.originalY = 0;
self.isPlaced = false;
self.targetSlot = null;
// Store reference to text for easier access
self.letterText = text;
self.down = function (x, y, obj) {
if (!self.isPlaced) {
// Find next available answer slot
var nextSlot = null;
for (var i = 0; i < answerSlots.length; i++) {
if (!answerSlots[i].occupiedLetter) {
nextSlot = answerSlots[i];
break;
}
}
if (nextSlot) {
placeLetter(self, nextSlot);
checkAnswer();
}
} else {
// Letter is placed, remove it from answer slot
removeLetter(self);
}
};
return self;
});
var LogoButton = Container.expand(function (logoName, logoData) {
var self = Container.call(this);
var bg = self.attachAsset('logoContainer', {
anchorX: 0.5,
anchorY: 0.5
});
// Get logo asset name from company name
var logoAssetName = logoData.name.toLowerCase() + 'Logo';
if (logoData.name === 'Real Madrid') {
logoAssetName = 'realmadridLogo';
}
if (logoData.name === 'Manchester United') {
logoAssetName = 'manchesterLogo';
}
if (logoData.name === 'McDonalds') {
logoAssetName = 'mcdonaldsLogo';
}
if (logoData.name === 'Pizza Hut') {
logoAssetName = 'pizzahutLogo';
}
if (logoData.name === 'Instagram') {
logoAssetName = 'instagramLogo';
}
if (logoData.name === 'TikTok') {
logoAssetName = 'tiktokLogo';
}
if (logoData.name === 'Burger King') {
logoAssetName = 'burgerkingLogo';
}
if (logoData.name === 'Bayern München') {
logoAssetName = 'bayernmunchenLogo';
}
if (logoData.name === 'Galatasaray') {
logoAssetName = 'galatasarayLogo';
}
if (logoData.name === 'Tesla') {
logoAssetName = 'teslaLogo';
}
if (logoData.name === 'Lamborghini') {
logoAssetName = 'lamborghiniLogo';
}
if (logoData.name === 'Tog') {
logoAssetName = 'togLogo';
}
if (logoData.name === 'ChatGPT') {
logoAssetName = 'chatgptLogo';
}
if (logoData.name === 'Xiaomi') {
logoAssetName = 'xiaomiLogo';
}
if (logoData.name === 'Twitter') {
logoAssetName = 'xLogo';
}
if (logoData.name === 'YouTube') {
logoAssetName = 'youtubeLogo';
}
if (logoData.name === 'Netflix') {
logoAssetName = 'netflixLogo';
}
if (logoData.name === 'Spotify') {
logoAssetName = 'spotifyLogo';
}
if (logoData.name === 'WhatsApp') {
logoAssetName = 'whatsappLogo';
}
if (logoData.name === 'Telegram') {
logoAssetName = 'telegramLogo';
}
if (logoData.name === 'Discord') {
logoAssetName = 'discordLogo';
}
if (logoData.name === 'Zoom') {
logoAssetName = 'zoomLogo';
}
if (logoData.name === 'Skype') {
logoAssetName = 'skypeLogo';
}
if (logoData.name === 'PayPal') {
logoAssetName = 'paypalLogo';
}
if (logoData.name === 'Amazon') {
logoAssetName = 'amazonLogo';
}
if (logoData.name === 'eBay') {
logoAssetName = 'ebayLogo';
}
if (logoData.name === 'Uber') {
logoAssetName = 'uberLogo';
}
if (logoData.name === 'Airbnb') {
logoAssetName = 'airbnbLogo';
}
// Footballers category assets
if (logoData.name === 'Messi') {
logoAssetName = 'messiLogo';
}
if (logoData.name === 'Ronaldo') {
logoAssetName = 'ronaldoLogo';
}
if (logoData.name === 'Neymar') {
logoAssetName = 'neymarLogo';
}
if (logoData.name === 'Mbappe') {
logoAssetName = 'mbappeLogo';
}
if (logoData.name === 'Haaland') {
logoAssetName = 'haalandLogo';
}
if (logoData.name === 'Benzema') {
logoAssetName = 'benzemaLogo';
}
if (logoData.name === 'Lewandowski') {
logoAssetName = 'lewandowskiLogo';
}
if (logoData.name === 'Mesut Ozil') {
logoAssetName = 'mesutoezilLogo';
}
if (logoData.name === 'Arda Guler') {
logoAssetName = 'ardagulerLogo';
}
if (logoData.name === 'Luka Modric') {
logoAssetName = 'lukamodricLogo';
}
if (logoData.name === 'Vinicius Junior') {
logoAssetName = 'viniciusjuniorLogo';
}
if (logoData.name === 'Erling Haaland') {
logoAssetName = 'erlinghaalandLogo';
}
if (logoData.name === 'Lamin Yemal') {
logoAssetName = 'laminyemalLogo';
}
// Flags category assets
if (logoData.name === 'Turkey') {
logoAssetName = 'turkeyLogo';
}
if (logoData.name === 'Germany') {
logoAssetName = 'germanyLogo';
}
if (logoData.name === 'France') {
logoAssetName = 'franceLogo';
}
if (logoData.name === 'Spain') {
logoAssetName = 'spainLogo';
}
if (logoData.name === 'Italy') {
logoAssetName = 'italyLogo';
}
if (logoData.name === 'Brazil') {
logoAssetName = 'brazilLogo';
}
if (logoData.name === 'Argentina') {
logoAssetName = 'argentinaLogo';
}
if (logoData.name === 'England') {
logoAssetName = 'englandLogo';
}
if (logoData.name === 'Portugal') {
logoAssetName = 'portugalLogo';
}
if (logoData.name === 'Netherlands') {
logoAssetName = 'netherlandsLogo';
}
if (logoData.name === 'Russia') {
logoAssetName = 'russiaLogo';
}
if (logoData.name === 'Japan') {
logoAssetName = 'japanLogo';
}
if (logoData.name === 'South Korea') {
logoAssetName = 'southkoreaLogo';
}
if (logoData.name === 'Mexico') {
logoAssetName = 'mexicoLogo';
}
if (logoData.name === 'Canada') {
logoAssetName = 'canadaLogo';
}
if (logoData.name === 'Australia') {
logoAssetName = 'australiaLogo';
}
if (logoData.name === 'Greece') {
logoAssetName = 'greeceLogo';
}
if (logoData.name === 'Belgium') {
logoAssetName = 'belgiumLogo';
}
if (logoData.name === 'Croatia') {
logoAssetName = 'croatiaLogo';
}
if (logoData.name === 'Poland') {
logoAssetName = 'polandLogo';
}
if (logoData.name === 'Sweden') {
logoAssetName = 'swedenLogo';
}
// Games category assets
if (logoData.name === 'Minecraft') {
logoAssetName = 'minecraftLogo';
}
if (logoData.name === 'Fortnite') {
logoAssetName = 'fortniteLogo';
}
if (logoData.name === 'PUBG') {
logoAssetName = 'pubgLogo';
}
if (logoData.name === 'Among Us') {
logoAssetName = 'amongusLogo';
}
if (logoData.name === 'Clash of Clans') {
logoAssetName = 'clashofclansLogo';
}
if (logoData.name === 'Clash Royale') {
logoAssetName = 'clashroyaleLogo';
}
if (logoData.name === 'Candy Crush') {
logoAssetName = 'candycrushLogo';
}
if (logoData.name === 'Pokemon Go') {
logoAssetName = 'pokemongoLogo';
}
if (logoData.name === 'Subway Surfers') {
logoAssetName = 'subwaysurfersLogo';
}
if (logoData.name === 'Temple Run') {
logoAssetName = 'templerunLogo';
}
if (logoData.name === 'Angry Birds') {
logoAssetName = 'angrybirdsLogo';
}
if (logoData.name === 'Roblox') {
logoAssetName = 'robloxLogo';
}
if (logoData.name === 'Counter Strike') {
logoAssetName = 'counterstrikeLogo';
}
if (logoData.name === 'League of Legends') {
logoAssetName = 'leagueoflegendsLogo';
}
if (logoData.name === 'Dota 2') {
logoAssetName = 'dota2Logo';
}
if (logoData.name === 'World of Warcraft') {
logoAssetName = 'worldofwarcraftLogo';
}
if (logoData.name === 'Valorant') {
logoAssetName = 'valorantLogo';
}
if (logoData.name === 'Apex Legends') {
logoAssetName = 'apexlegendsLogo';
}
if (logoData.name === 'Call of Duty') {
logoAssetName = 'callofdutyLogo';
}
if (logoData.name === 'Grand Theft Auto') {
logoAssetName = 'grandtheftautoLogo';
}
if (logoData.name === 'Overwatch') {
logoAssetName = 'overwatchLogo';
}
if (logoData.name === 'Steam') {
logoAssetName = 'steamLogo';
}
var logoVisual = self.attachAsset(logoAssetName, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
self.logoData = logoData;
self.down = function (x, y, obj) {
// Check if logo is completed
var logoKey = currentCategory + '_' + self.logoData.name;
if (completedLogos[logoKey]) {
// Show completed logo name instead of starting the game
showCompletedLogo(self.logoData);
return;
}
self.scaleX = 0.95;
self.scaleY = 0.95;
startLogoGuess(self.logoData);
};
self.up = function (x, y, obj) {
self.scaleX = 1;
self.scaleY = 1;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2C3E50
});
/****
* Game Code
****/
// Game state variables
// Logo assets - Technology
// Logo assets - Football
// Logo assets - Cars
// Logo assets - Food
// Placeholder assets for logos without images - using shapes with category-specific colors
var gameState = 'menu'; // 'menu', 'category', 'guessing'
var goldCoins = storage.goldCoins || 25;
var currentLanguage = storage.currentLanguage || 'tr'; // 'tr' for Turkish, 'en' for English
var completedLogos = storage.completedLogos || {};
var completedWithoutHints = storage.completedWithoutHints || {};
var categoryCompletions = storage.categoryCompletions || {
'Technology': 0,
'Football': 0,
'Cars': 0,
'Food': 0,
'Footballers': 0,
'Flags': 0,
'Games': 0
};
var currentLogoUsedHint = false;
// Recalculate category completions based on completed logos to ensure accuracy
function updateCategoryCompletions() {
// Reset counts
for (var category in categoryCompletions) {
categoryCompletions[category] = 0;
}
// Count ALL completed logos for category unlocking
for (var logoKey in completedLogos) {
if (completedLogos[logoKey]) {
var category = logoKey.split('_')[0];
if (categoryCompletions[category] !== undefined) {
categoryCompletions[category]++;
}
}
}
storage.categoryCompletions = categoryCompletions;
}
// Update completions on game start
updateCategoryCompletions();
var currentCategory = '';
var currentLogo = null;
var draggedLetter = null;
var letterTiles = [];
var answerSlots = [];
var currentAnswer = '';
// Pagination variables for all categories
var TechnologyPage = 0;
var FootballPage = 0;
var CarsPage = 0;
var FoodPage = 0;
var FootballersPage = 0;
var FlagsPage = 0;
var GamesPage = 0;
var logosPerPage = 12;
// Language configuration
var languageTexts = {
tr: {
title: 'Logo Quiz Challenge',
completed: 'Tamamlanan: ',
settings: 'Ayarlar',
language: 'Dil',
turkish: 'Türkçe',
english: 'İngilizce',
resetData: 'Tüm Verileri Sıfırla',
backToMenu: 'Ana Menüye Dön',
resetConfirm: 'Silmek İstediğinden Emin Misin?',
yes: 'Evet',
no: 'Hayır',
completedText: 'TAMAMLANDI'
},
en: {
title: 'Logo Quiz Challenge',
completed: 'Completed: ',
settings: 'Settings',
language: 'Language',
turkish: 'Turkish',
english: 'English',
resetData: 'Reset All Data',
backToMenu: 'Back to Menu',
resetConfirm: 'Are you sure you want to delete?',
yes: 'Yes',
no: 'No',
completedText: 'COMPLETED'
}
};
// Logo data
var logoDatabase = {
'Technology': [{
name: 'Apple',
answer: 'APPLE'
}, {
name: 'Google',
answer: 'GOOGLE'
}, {
name: 'Microsoft',
answer: 'MICROSOFT'
}, {
name: 'Samsung',
answer: 'SAMSUNG'
}, {
name: 'Instagram',
answer: 'INSTAGRAM'
}, {
name: 'TikTok',
answer: 'TIKTOK'
}, {
name: 'ChatGPT',
answer: 'CHATGPT'
}, {
name: 'Xiaomi',
answer: 'XIAOMI'
}, {
name: 'Facebook',
answer: 'FACEBOOK'
}, {
name: 'X',
answer: 'X'
}, {
name: 'YouTube',
answer: 'YOUTUBE'
}, {
name: 'Netflix',
answer: 'NETFLIX'
}, {
name: 'Spotify',
answer: 'SPOTIFY'
}, {
name: 'WhatsApp',
answer: 'WHATSAPP'
}, {
name: 'Telegram',
answer: 'TELEGRAM'
}, {
name: 'Discord',
answer: 'DISCORD'
}, {
name: 'Zoom',
answer: 'ZOOM'
}, {
name: 'Skype',
answer: 'SKYPE'
}, {
name: 'PayPal',
answer: 'PAYPAL'
}, {
name: 'Amazon',
answer: 'AMAZON'
}, {
name: 'eBay',
answer: 'EBAY'
}, {
name: 'Uber',
answer: 'UBER'
}, {
name: 'Airbnb',
answer: 'AIRBNB'
}],
'Football': [{
name: 'Barcelona',
answer: 'BARCELONA'
}, {
name: 'Real Madrid',
answer: 'REALMADRID'
}, {
name: 'Liverpool',
answer: 'LIVERPOOL'
}, {
name: 'Manchester United',
answer: 'MANCHESTER'
}, {
name: 'Arsenal',
answer: 'ARSENAL'
}, {
name: 'Bayern München',
answer: 'BAYERNMUNCHEN'
}, {
name: 'Galatasaray',
answer: 'GALATASARAY'
}, {
name: 'Chelsea',
answer: 'CHELSEA'
}, {
name: 'Manchester City',
answer: 'MANCHESTERCITY'
}, {
name: 'Inter Milan',
answer: 'INTERMILAN'
}, {
name: 'Juventus',
answer: 'JUVENTUS'
}, {
name: 'PSG',
answer: 'PSG'
}, {
name: 'AC Milan',
answer: 'ACMILAN'
}],
'Cars': [{
name: 'BMW',
answer: 'BMW'
}, {
name: 'Mercedes',
answer: 'MERCEDES'
}, {
name: 'Toyota',
answer: 'TOYOTA'
}, {
name: 'Ferrari',
answer: 'FERRARI'
}, {
name: 'Audi',
answer: 'AUDI'
}, {
name: 'Tesla',
answer: 'TESLA'
}, {
name: 'Lamborghini',
answer: 'LAMBORGHINI'
}, {
name: 'Tog',
answer: 'TOGG'
}, {
name: 'Porsche',
answer: 'PORSCHE'
}, {
name: 'Bugatti',
answer: 'BUGATTI'
}, {
name: 'Nissan',
answer: 'NISSAN'
}, {
name: 'Honda',
answer: 'HONDA'
}, {
name: 'Volkswagen',
answer: 'VOLKSWAGEN'
}],
'Food': [{
name: 'McDonalds',
answer: 'MCDONALDS'
}, {
name: 'KFC',
answer: 'KFC'
}, {
name: 'Subway',
answer: 'SUBWAY'
}, {
name: 'Pizza Hut',
answer: 'PIZZAHUT'
}, {
name: 'Starbucks',
answer: 'STARBUCKS'
}, {
name: 'Dominos',
answer: 'DOMINOS'
}, {
name: 'Burger King',
answer: 'BURGERKING'
}, {
name: 'Coca Cola',
answer: 'COCACOLA'
}, {
name: 'Pepsi',
answer: 'PEPSI'
}, {
name: 'Sprite',
answer: 'SPRITE'
}, {
name: 'Fanta',
answer: 'FANTA'
}, {
name: 'Heinz',
answer: 'HEINZ'
}, {
name: 'Nestle',
answer: 'NESTLE'
}, {
name: 'Oreo',
answer: 'OREO'
}],
'Footballers': [{
name: 'Messi',
answer: 'MESSI'
}, {
name: 'Ronaldo',
answer: 'RONALDO'
}, {
name: 'Neymar',
answer: 'NEYMAR'
}, {
name: 'Mbappe',
answer: 'MBAPPE'
}, {
name: 'Haaland',
answer: 'HAALAND'
}, {
name: 'Benzema',
answer: 'BENZEMA'
}, {
name: 'Lewandowski',
answer: 'LEWANDOWSKI'
}, {
name: 'Mesut Ozil',
answer: 'MESUTOEZIL'
}, {
name: 'Arda Guler',
answer: 'ARDAGULER'
}, {
name: 'Luka Modric',
answer: 'LUKAMODRIC'
}, {
name: 'Vinicius Junior',
answer: 'VINICIUSJUNIOR'
}, {
name: 'Lamin Yemal',
answer: 'LAMINYEMAL'
}, {
name: 'Gianluigi Donnarumma',
answer: 'DONNARUMMA'
}, {
name: 'Karim Benzema',
answer: 'KARIMBEN'
}, {
name: 'Robert Lewandowski',
answer: 'ROBERT'
}, {
name: 'Jan Oblak',
answer: 'OBLAK'
}, {
name: 'Sergio Ramos',
answer: 'RAMOS'
}, {
name: 'Gerard Pique',
answer: 'PIQUE'
}, {
name: 'Dani Alves',
answer: 'ALVES'
}],
'Flags': [{
name: 'Turkey',
answer: 'TURKEY',
answerTR: 'TURKIYE'
}, {
name: 'Germany',
answer: 'GERMANY',
answerTR: 'ALMANYA'
}, {
name: 'France',
answer: 'FRANCE',
answerTR: 'FRANSA'
}, {
name: 'Spain',
answer: 'SPAIN',
answerTR: 'ISPANYA'
}, {
name: 'Italy',
answer: 'ITALY',
answerTR: 'ITALYA'
}, {
name: 'Brazil',
answer: 'BRAZIL',
answerTR: 'BREZILYA'
}, {
name: 'Argentina',
answer: 'ARGENTINA',
answerTR: 'ARJANTIN'
}, {
name: 'England',
answer: 'ENGLAND',
answerTR: 'INGILTERE'
}, {
name: 'Portugal',
answer: 'PORTUGAL',
answerTR: 'PORTEKIZ'
}, {
name: 'Netherlands',
answer: 'NETHERLANDS',
answerTR: 'HOLLANDA'
}, {
name: 'Russia',
answer: 'RUSSIA',
answerTR: 'RUSYA'
}, {
name: 'Japan',
answer: 'JAPAN',
answerTR: 'JAPONYA'
}, {
name: 'South Korea',
answer: 'SOUTHKOREA',
answerTR: 'GUNEYKORE'
}, {
name: 'Mexico',
answer: 'MEXICO',
answerTR: 'MEKSIKA'
}, {
name: 'Canada',
answer: 'CANADA',
answerTR: 'KANADA'
}, {
name: 'Australia',
answer: 'AUSTRALIA',
answerTR: 'AVUSTRALYA'
}, {
name: 'Greece',
answer: 'GREECE',
answerTR: 'YUNANISTAN'
}, {
name: 'Belgium',
answer: 'BELGIUM',
answerTR: 'BELCIKA'
}, {
name: 'Croatia',
answer: 'CROATIA',
answerTR: 'HIRVATISTAN'
}, {
name: 'Poland',
answer: 'POLAND',
answerTR: 'POLONYA'
}, {
name: 'Sweden',
answer: 'SWEDEN',
answerTR: 'ISVEC'
}],
'Games': [{
name: 'Minecraft',
answer: 'MINECRAFT'
}, {
name: 'Fortnite',
answer: 'FORTNITE'
}, {
name: 'PUBG',
answer: 'PUBG'
}, {
name: 'Among Us',
answer: 'AMONGUS'
}, {
name: 'Clash of Clans',
answer: 'CLASHOFCLANS'
}, {
name: 'Clash Royale',
answer: 'CLASHROYALE'
}, {
name: 'Candy Crush',
answer: 'CANDYCRUSH'
}, {
name: 'Pokemon Go',
answer: 'POKEMONGO'
}, {
name: 'Subway Surfers',
answer: 'SUBWAYSURFERS'
}, {
name: 'Temple Run',
answer: 'TEMPLERUN'
}, {
name: 'Angry Birds',
answer: 'ANGRYBIRDS'
}, {
name: 'Roblox',
answer: 'ROBLOX'
}, {
name: 'Counter Strike',
answer: 'COUNTERSTRIKE'
}, {
name: 'League of Legends',
answer: 'LEAGUEOFLEGENDS'
}, {
name: 'Dota 2',
answer: 'DOTA2'
}, {
name: 'World of Warcraft',
answer: 'WORLDOFWARCRAFT'
}, {
name: 'Valorant',
answer: 'VALORANT'
}, {
name: 'Apex Legends',
answer: 'APEXLEGENDS'
}, {
name: 'Call of Duty',
answer: 'CALLOFDUTY'
}, {
name: 'Grand Theft Auto',
answer: 'GRANDTHEFTAUTO'
}, {
name: 'Overwatch',
answer: 'OVERWATCH'
}, {
name: 'Steam',
answer: 'STEAM'
}]
};
// UI Elements
var coinDisplay;
var backButton;
function isCategoryUnlocked(category) {
// Technology is always unlocked
if (category === 'Technology') return true;
// Football unlocks after 2 Technology completions
if (category === 'Football') return categoryCompletions['Technology'] >= 2;
// Cars unlocks after 2 Football completions
if (category === 'Cars') return categoryCompletions['Football'] >= 2;
// Food unlocks after 2 Cars completions
if (category === 'Food') return categoryCompletions['Cars'] >= 2;
// Footballers unlocks after 2 Food completions
if (category === 'Footballers') return categoryCompletions['Food'] >= 2;
// Flags unlocks after 2 Footballers completions
if (category === 'Flags') return categoryCompletions['Footballers'] >= 2;
// Games unlocks after 2 Flags completions
if (category === 'Games') return categoryCompletions['Flags'] >= 2;
return false;
}
function showLockedCategoryMessage(category) {
// Calculate requirements
var requiredCategory = '';
var requiredCount = 2;
var currentCompleted = 0;
var remaining = 0;
if (category === 'Football') {
requiredCategory = 'Technology';
currentCompleted = categoryCompletions['Technology'];
} else if (category === 'Cars') {
requiredCategory = 'Football';
currentCompleted = categoryCompletions['Football'];
} else if (category === 'Food') {
requiredCategory = 'Cars';
currentCompleted = categoryCompletions['Cars'];
} else if (category === 'Footballers') {
requiredCategory = 'Food';
currentCompleted = categoryCompletions['Food'];
} else if (category === 'Flags') {
requiredCategory = 'Footballers';
currentCompleted = categoryCompletions['Footballers'];
} else if (category === 'Games') {
requiredCategory = 'Flags';
currentCompleted = categoryCompletions['Flags'];
}
remaining = Math.max(0, requiredCount - currentCompleted);
// Create overlay message
var messageOverlay = new Container();
messageOverlay.x = 1024;
messageOverlay.y = 1366;
// Semi-transparent background
var bgShape = LK.getAsset('categoryButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 2.0
});
bgShape.tint = 0x000000;
bgShape.alpha = 0.8;
messageOverlay.addChild(bgShape);
// Main message text
var messageText = new Text2('Kilitli Kategori!', {
size: 80,
fill: 0xFF0000
});
messageText.anchor.set(0.5, 0.5);
messageText.y = -80;
messageOverlay.addChild(messageText);
// Requirement text showing remaining count
var requirementText = new Text2(remaining + ' tane daha ' + requiredCategory + ' çözmen gerekiyor', {
size: 60,
fill: 0xFFFFFF
});
requirementText.anchor.set(0.5, 0.5);
requirementText.y = 0;
messageOverlay.addChild(requirementText);
// Progress text showing current progress
var progressText = new Text2('Şu anda: ' + currentCompleted + '/' + requiredCount, {
size: 50,
fill: 0xFFD700
});
progressText.anchor.set(0.5, 0.5);
progressText.y = 60;
messageOverlay.addChild(progressText);
// Add to game
game.addChild(messageOverlay);
// Auto-remove after 3 seconds
LK.setTimeout(function () {
if (messageOverlay.parent) {
messageOverlay.parent.removeChild(messageOverlay);
messageOverlay.destroy();
}
}, 3000);
}
function initializeMenu() {
game.removeChildren();
gameState = 'menu';
// Reset pagination for all categories
TechnologyPage = 0;
FootballPage = 0;
CarsPage = 0;
FoodPage = 0;
FootballersPage = 0;
FlagsPage = 0;
GamesPage = 0;
// Title
var title = new Text2(languageTexts[currentLanguage].title, {
size: 120,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 500;
game.addChild(title);
// Calculate and display total completions
var totalCompleted = Object.keys(completedLogos).length;
var totalLogos = 0;
for (var category in logoDatabase) {
totalLogos += logoDatabase[category].length;
}
var progressText = new Text2(languageTexts[currentLanguage].completed + totalCompleted + '/' + totalLogos, {
size: 80,
fill: 0xFFD700
});
progressText.anchor.set(0.5, 0.5);
progressText.x = 1024;
progressText.y = 600;
game.addChild(progressText);
// Play button
var playButton = new CategoryButton('Oynamaya Başla');
playButton.x = 1024;
playButton.y = 750;
playButton.down = function (x, y, obj) {
playButton.scaleX = 0.95;
playButton.scaleY = 0.95;
showCategorySelection();
};
playButton.up = function (x, y, obj) {
playButton.scaleX = 1;
playButton.scaleY = 1;
};
game.addChild(playButton);
// Category buttons
var categories = ['Technology', 'Football', 'Cars', 'Food', 'Footballers', 'Flags', 'Games'];
for (var i = 0; i < categories.length; i++) {
var isUnlocked = isCategoryUnlocked(categories[i]);
var button = new CategoryButton(categories[i]);
button.x = 1024;
button.y = 800 + i * 220;
// Visual feedback for locked categories
if (!isUnlocked) {
button.alpha = 0.5;
// Override the down handler to show requirement message for locked categories
button.down = function (x, y, obj) {
showLockedCategoryMessage(categories[i]);
};
// Add lock symbol
var lockText = new Text2('🔒', {
size: 60,
fill: 0xFFFFFF
});
lockText.anchor.set(0.5, 0.5);
lockText.x = 300; // Position to the right of category name
lockText.y = 0;
button.addChild(lockText);
// Show completion requirement
var reqText = '';
if (categories[i] === 'Football') reqText = '(' + categoryCompletions['Technology'] + '/2 Technology)';else if (categories[i] === 'Cars') reqText = '(' + categoryCompletions['Football'] + '/2 Football)';else if (categories[i] === 'Food') reqText = '(' + categoryCompletions['Cars'] + '/2 Cars)';else if (categories[i] === 'Footballers') reqText = '(' + categoryCompletions['Food'] + '/2 Food)';else if (categories[i] === 'Flags') reqText = '(' + categoryCompletions['Footballers'] + '/2 Footballers)';else if (categories[i] === 'Games') reqText = '(' + categoryCompletions['Flags'] + '/2 Flags)';
if (reqText) {
var requirementText = new Text2(reqText, {
size: 40,
fill: 0xFFFFFF
});
requirementText.anchor.set(0.5, 0.5);
requirementText.x = 0;
requirementText.y = 60;
button.addChild(requirementText);
}
}
game.addChild(button);
}
updateCoinDisplay();
}
function showCategorySelection() {
// Batch clear operations for better performance
while (game.children.length > 0) {
var child = game.children[0];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
gameState = 'categorySelect';
// Title
var title = new Text2('Kategori Seç', {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
game.addChild(title);
// Category buttons
var categories = ['Technology', 'Football', 'Cars', 'Food', 'Footballers', 'Flags', 'Games'];
for (var i = 0; i < categories.length; i++) {
var isUnlocked = isCategoryUnlocked(categories[i]);
var button = new CategoryButton(categories[i]);
button.x = 1024;
button.y = 700 + i * 200;
// Visual feedback for locked categories
if (!isUnlocked) {
button.alpha = 0.5;
// Override the down handler to show requirement message for locked categories
button.down = function (x, y, obj) {
showLockedCategoryMessage(categories[i]);
};
// Add lock symbol
var lockText = new Text2('🔒', {
size: 60,
fill: 0xFFFFFF
});
lockText.anchor.set(0.5, 0.5);
lockText.x = 300;
lockText.y = 0;
button.addChild(lockText);
// Show completion requirement
var reqText = '';
if (categories[i] === 'Football') reqText = '(' + categoryCompletions['Technology'] + '/2 Technology)';else if (categories[i] === 'Cars') reqText = '(' + categoryCompletions['Football'] + '/2 Football)';else if (categories[i] === 'Food') reqText = '(' + categoryCompletions['Cars'] + '/2 Cars)';else if (categories[i] === 'Footballers') reqText = '(' + categoryCompletions['Food'] + '/2 Food)';else if (categories[i] === 'Flags') reqText = '(' + categoryCompletions['Footballers'] + '/2 Footballers)';else if (categories[i] === 'Games') reqText = '(' + categoryCompletions['Flags'] + '/2 Flags)';
if (reqText) {
var requirementText = new Text2(reqText, {
size: 40,
fill: 0xFFFFFF
});
requirementText.anchor.set(0.5, 0.5);
requirementText.x = 0;
requirementText.y = 60;
button.addChild(requirementText);
}
}
game.addChild(button);
}
// Back button to return to main menu
var backBtn = new ExitButton();
backBtn.x = 1848;
backBtn.y = 350;
backBtn.down = function (x, y, obj) {
backBtn.scaleX = 0.95;
backBtn.scaleY = 0.95;
initializeMenu();
};
backBtn.up = function (x, y, obj) {
backBtn.scaleX = 1;
backBtn.scaleY = 1;
};
game.addChild(backBtn);
updateCoinDisplay();
}
function showCategoryLogos(category) {
// Batch clear operations for better performance
while (game.children.length > 0) {
var child = game.children[0];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
gameState = 'category';
currentCategory = category;
// Category title
var title = new Text2(category + ' Logos', {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
game.addChild(title);
// Show category completion stats
var categoryCompleted = categoryCompletions[category] || 0;
var categoryTotal = logoDatabase[category].length;
var statsText = new Text2('Tamamlanan: ' + categoryCompleted + '/' + categoryTotal, {
size: 60,
fill: 0xFFD700
});
statsText.anchor.set(0.5, 0.5);
statsText.x = 1024;
statsText.y = 480;
game.addChild(statsText);
// Logo buttons - filter out completed logos
var logos = logoDatabase[category];
var availableLogos = [];
for (var i = 0; i < logos.length; i++) {
var logoKey = category + '_' + logos[i].name;
if (!completedLogos[logoKey]) {
availableLogos.push(logos[i]);
}
}
var cols = 3;
var startX = 1024 - (cols - 1) * 250;
var startY = 700;
// Handle pagination for all categories
var allLogos = logoDatabase[category];
var logosToShow = allLogos;
var showPagination = false;
// Check if category needs pagination (more than 12 logos)
if (allLogos.length > 12) {
showPagination = true;
var currentPage = 0;
// Get current page for this category
if (category === 'Technology') currentPage = TechnologyPage;else if (category === 'Football') currentPage = FootballPage;else if (category === 'Cars') currentPage = CarsPage;else if (category === 'Food') currentPage = FoodPage;else if (category === 'Footballers') currentPage = FootballersPage;else if (category === 'Flags') currentPage = FlagsPage;else if (category === 'Games') currentPage = GamesPage;
var logosPerPage = 12;
var startIndex = currentPage * logosPerPage;
var endIndex = Math.min(startIndex + logosPerPage, allLogos.length);
logosToShow = allLogos.slice(startIndex, endIndex);
}
// Show logos with completion status
for (var i = 0; i < logosToShow.length; i++) {
var logoButton = new LogoButton(logosToShow[i].name + 'Logo', logosToShow[i]);
logoButton.x = startX + i % cols * 500;
logoButton.y = startY + Math.floor(i / cols) * 450;
game.addChild(logoButton);
// Check if this logo is completed and add checkmark
var logoKey = category + '_' + logosToShow[i].name;
if (completedLogos[logoKey]) {
var checkmark = logoButton.attachAsset('checkmark', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
checkmark.x = 150; // Position in top-right corner of logo button
checkmark.y = -150;
}
}
// Add pagination buttons for all categories with more than 12 logos - positioned at bottom
if (showPagination) {
var currentPageKey = category + 'Page';
var currentPage = 0;
// Get current page for this category
if (category === 'Technology') currentPage = TechnologyPage;else if (category === 'Football') currentPage = FootballPage;else if (category === 'Cars') currentPage = CarsPage;else if (category === 'Food') currentPage = FoodPage;else if (category === 'Footballers') currentPage = FootballersPage;else if (category === 'Flags') currentPage = FlagsPage;else if (category === 'Games') currentPage = GamesPage;
var totalPages = Math.ceil(allLogos.length / logosPerPage);
var paginationY = 2400; // Move even lower for better spacing
// Previous page button
if (currentPage > 0) {
var prevButton = new CategoryButton('◄ Önceki');
prevButton.x = 400;
prevButton.y = paginationY;
prevButton.scaleX = 0.9;
prevButton.scaleY = 0.9;
prevButton.down = function (x, y, obj) {
prevButton.scaleX = 0.85;
prevButton.scaleY = 0.85;
// Update the correct category page variable
if (category === 'Technology') TechnologyPage--;else if (category === 'Football') FootballPage--;else if (category === 'Cars') CarsPage--;else if (category === 'Food') FoodPage--;else if (category === 'Footballers') FootballersPage--;else if (category === 'Flags') FlagsPage--;else if (category === 'Games') GamesPage--;
showCategoryLogos(category);
};
prevButton.up = function (x, y, obj) {
prevButton.scaleX = 0.9;
prevButton.scaleY = 0.9;
};
game.addChild(prevButton);
}
// Page indicator
var pageText = new Text2('Sayfa ' + (currentPage + 1) + '/' + totalPages, {
size: 70,
fill: 0xFFFFFF
});
pageText.anchor.set(0.5, 0.5);
pageText.x = 1024;
pageText.y = paginationY;
game.addChild(pageText);
// Next page button
if (currentPage < totalPages - 1) {
var nextButton = new CategoryButton('Sonraki ►');
nextButton.x = 1548; // Move button more to the left
nextButton.y = paginationY;
nextButton.scaleX = 0.8; // Make button smaller
nextButton.scaleY = 0.8; // Make button smaller
nextButton.down = function (x, y, obj) {
nextButton.scaleX = 0.75;
nextButton.scaleY = 0.75;
// Update the correct category page variable
if (category === 'Technology') TechnologyPage++;else if (category === 'Football') FootballPage++;else if (category === 'Cars') CarsPage++;else if (category === 'Food') FoodPage++;else if (category === 'Footballers') FootballersPage++;else if (category === 'Flags') FlagsPage++;else if (category === 'Games') GamesPage++;
showCategoryLogos(category);
};
nextButton.up = function (x, y, obj) {
nextButton.scaleX = 0.8;
nextButton.scaleY = 0.8;
};
game.addChild(nextButton);
}
}
// Exit button
var exitBtn = new ExitButton();
exitBtn.x = 1848; // Position in top right area, below coins
exitBtn.y = 350; // Further below the coin display
exitBtn.down = function (x, y, obj) {
exitBtn.scaleX = 0.95;
exitBtn.scaleY = 0.95;
initializeMenu(); // Return to main menu instead of category
};
exitBtn.up = function (x, y, obj) {
exitBtn.scaleX = 1;
exitBtn.scaleY = 1;
};
game.addChild(exitBtn);
updateCoinDisplay();
}
function startLogoGuess(logoData) {
// Efficient cleanup
while (game.children.length > 0) {
var child = game.children[0];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
gameState = 'guessing';
currentLogo = logoData;
currentLogoUsedHint = false;
// Clear arrays efficiently
letterTiles.length = 0;
answerSlots.length = 0;
// Logo display area - larger and more prominent visual logo
var logoAssetName = logoData.name.toLowerCase() + 'Logo';
if (logoData.name === 'Real Madrid') {
logoAssetName = 'realmadridLogo';
}
if (logoData.name === 'Manchester United') {
logoAssetName = 'manchesterLogo';
}
if (logoData.name === 'McDonalds') {
logoAssetName = 'mcdonaldsLogo';
}
if (logoData.name === 'Pizza Hut') {
logoAssetName = 'pizzahutLogo';
}
if (logoData.name === 'Instagram') {
logoAssetName = 'instagramLogo';
}
if (logoData.name === 'TikTok') {
logoAssetName = 'tiktokLogo';
}
if (logoData.name === 'Burger King') {
logoAssetName = 'burgerkingLogo';
}
if (logoData.name === 'Bayern München') {
logoAssetName = 'bayernmunchenLogo';
}
if (logoData.name === 'Galatasaray') {
logoAssetName = 'galatasarayLogo';
}
if (logoData.name === 'Tesla') {
logoAssetName = 'teslaLogo';
}
if (logoData.name === 'Lamborghini') {
logoAssetName = 'lamborghiniLogo';
}
if (logoData.name === 'Tog') {
logoAssetName = 'togLogo';
}
if (logoData.name === 'ChatGPT') {
logoAssetName = 'chatgptLogo';
}
if (logoData.name === 'Xiaomi') {
logoAssetName = 'xiaomiLogo';
}
if (logoData.name === 'Twitter') {
logoAssetName = 'xLogo';
}
if (logoData.name === 'YouTube') {
logoAssetName = 'youtubeLogo';
}
if (logoData.name === 'Netflix') {
logoAssetName = 'netflixLogo';
}
if (logoData.name === 'Spotify') {
logoAssetName = 'spotifyLogo';
}
if (logoData.name === 'WhatsApp') {
logoAssetName = 'whatsappLogo';
}
if (logoData.name === 'Telegram') {
logoAssetName = 'telegramLogo';
}
if (logoData.name === 'Discord') {
logoAssetName = 'discordLogo';
}
if (logoData.name === 'Zoom') {
logoAssetName = 'zoomLogo';
}
if (logoData.name === 'Skype') {
logoAssetName = 'skypeLogo';
}
if (logoData.name === 'PayPal') {
logoAssetName = 'paypalLogo';
}
if (logoData.name === 'Amazon') {
logoAssetName = 'amazonLogo';
}
if (logoData.name === 'eBay') {
logoAssetName = 'ebayLogo';
}
if (logoData.name === 'Uber') {
logoAssetName = 'uberLogo';
}
if (logoData.name === 'Airbnb') {
logoAssetName = 'airbnbLogo';
}
// Footballers category assets
if (logoData.name === 'Messi') {
logoAssetName = 'messiLogo';
}
if (logoData.name === 'Ronaldo') {
logoAssetName = 'ronaldoLogo';
}
if (logoData.name === 'Neymar') {
logoAssetName = 'neymarLogo';
}
if (logoData.name === 'Mbappe') {
logoAssetName = 'mbappeLogo';
}
if (logoData.name === 'Haaland') {
logoAssetName = 'haalandLogo';
}
if (logoData.name === 'Benzema') {
logoAssetName = 'benzemaLogo';
}
if (logoData.name === 'Lewandowski') {
logoAssetName = 'lewandowskiLogo';
}
if (logoData.name === 'Mesut Ozil') {
logoAssetName = 'mesutoezilLogo';
}
if (logoData.name === 'Arda Guler') {
logoAssetName = 'ardagulerLogo';
}
if (logoData.name === 'Luka Modric') {
logoAssetName = 'lukamodricLogo';
}
if (logoData.name === 'Vinicius Junior') {
logoAssetName = 'viniciusjuniorLogo';
}
if (logoData.name === 'Erling Haaland') {
logoAssetName = 'erlinghaalandLogo';
}
if (logoData.name === 'Lamin Yemal') {
logoAssetName = 'laminyemalLogo';
}
// Flags category assets
if (logoData.name === 'Turkey') {
logoAssetName = 'turkeyLogo';
}
if (logoData.name === 'Germany') {
logoAssetName = 'germanyLogo';
}
if (logoData.name === 'France') {
logoAssetName = 'franceLogo';
}
if (logoData.name === 'Spain') {
logoAssetName = 'spainLogo';
}
if (logoData.name === 'Italy') {
logoAssetName = 'italyLogo';
}
if (logoData.name === 'Brazil') {
logoAssetName = 'brazilLogo';
}
if (logoData.name === 'Argentina') {
logoAssetName = 'argentinaLogo';
}
if (logoData.name === 'England') {
logoAssetName = 'englandLogo';
}
if (logoData.name === 'Portugal') {
logoAssetName = 'portugalLogo';
}
if (logoData.name === 'Netherlands') {
logoAssetName = 'netherlandsLogo';
}
if (logoData.name === 'Russia') {
logoAssetName = 'russiaLogo';
}
if (logoData.name === 'Japan') {
logoAssetName = 'japanLogo';
}
if (logoData.name === 'South Korea') {
logoAssetName = 'southkoreaLogo';
}
if (logoData.name === 'Mexico') {
logoAssetName = 'mexicoLogo';
}
if (logoData.name === 'Canada') {
logoAssetName = 'canadaLogo';
}
if (logoData.name === 'Australia') {
logoAssetName = 'australiaLogo';
}
if (logoData.name === 'Greece') {
logoAssetName = 'greeceLogo';
}
if (logoData.name === 'Belgium') {
logoAssetName = 'belgiumLogo';
}
if (logoData.name === 'Croatia') {
logoAssetName = 'croatiaLogo';
}
if (logoData.name === 'Poland') {
logoAssetName = 'polandLogo';
}
if (logoData.name === 'Sweden') {
logoAssetName = 'swedenLogo';
}
// Games category assets
if (logoData.name === 'Minecraft') {
logoAssetName = 'minecraftLogo';
}
if (logoData.name === 'Fortnite') {
logoAssetName = 'fortniteLogo';
}
if (logoData.name === 'PUBG') {
logoAssetName = 'pubgLogo';
}
if (logoData.name === 'Among Us') {
logoAssetName = 'amongusLogo';
}
if (logoData.name === 'Clash of Clans') {
logoAssetName = 'clashofclansLogo';
}
if (logoData.name === 'Clash Royale') {
logoAssetName = 'clashroyaleLogo';
}
if (logoData.name === 'Candy Crush') {
logoAssetName = 'candycrushLogo';
}
if (logoData.name === 'Pokemon Go') {
logoAssetName = 'pokemongoLogo';
}
if (logoData.name === 'Subway Surfers') {
logoAssetName = 'subwaysurfersLogo';
}
if (logoData.name === 'Temple Run') {
logoAssetName = 'templerunLogo';
}
if (logoData.name === 'Angry Birds') {
logoAssetName = 'angrybirdsLogo';
}
if (logoData.name === 'Roblox') {
logoAssetName = 'robloxLogo';
}
if (logoData.name === 'Counter Strike') {
logoAssetName = 'counterstrikeLogo';
}
if (logoData.name === 'League of Legends') {
logoAssetName = 'leagueoflegendsLogo';
}
if (logoData.name === 'Dota 2') {
logoAssetName = 'dota2Logo';
}
if (logoData.name === 'World of Warcraft') {
logoAssetName = 'worldofwarcraftLogo';
}
if (logoData.name === 'Valorant') {
logoAssetName = 'valorantLogo';
}
if (logoData.name === 'Apex Legends') {
logoAssetName = 'apexlegendsLogo';
}
if (logoData.name === 'Call of Duty') {
logoAssetName = 'callofdutyLogo';
}
if (logoData.name === 'Grand Theft Auto') {
logoAssetName = 'grandtheftautoLogo';
}
if (logoData.name === 'Overwatch') {
logoAssetName = 'overwatchLogo';
}
if (logoData.name === 'Steam') {
logoAssetName = 'steamLogo';
}
var logoVisual = LK.getAsset(logoAssetName, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
logoVisual.x = 1024;
logoVisual.y = 500;
game.addChild(logoVisual);
// Get the appropriate answer based on language and category
var currentAnswer = logoData.answer;
if (currentCategory === 'Flags' && currentLanguage === 'tr' && logoData.answerTR) {
currentAnswer = logoData.answerTR;
}
// Create answer slots with word separation
var answerLength = currentAnswer.length;
var slotSpacing = 140;
var wordGap = 60; // Extra space between words
// Determine word boundaries for multi-word answers
var wordBoundaries = [];
var displayName = currentLogo.name;
// Check for two-word combinations
if (displayName === 'Real Madrid' || displayName === 'Manchester United' || displayName === 'Pizza Hut' || displayName === 'Burger King' || displayName === 'Bayern München' || displayName === 'Mesut Ozil' || displayName === 'Arda Guler' || displayName === 'Luka Modric' || displayName === 'Vinicius Junior' || displayName === 'Lamin Yemal' || displayName === 'Clash of Clans' || displayName === 'Clash Royale' || displayName === 'Candy Crush' || displayName === 'Pokemon Go' || displayName === 'Subway Surfers' || displayName === 'Temple Run' || displayName === 'Angry Birds' || displayName === 'Counter Strike' || displayName === 'League of Legends' || displayName === 'Dota 2' || displayName === 'World of Warcraft' || displayName === 'Apex Legends' || displayName === 'Call of Duty' || displayName === 'Grand Theft Auto' || displayName === 'Among Us') {
// Find the word break position in the answer
var firstWordLength = 0;
if (displayName === 'Real Madrid') firstWordLength = 4; // REAL
else if (displayName === 'Manchester United') firstWordLength = 10; // MANCHESTER
else if (displayName === 'Pizza Hut') firstWordLength = 5; // PIZZA
else if (displayName === 'Burger King') firstWordLength = 6; // BURGER
else if (displayName === 'Bayern München') firstWordLength = 6; // BAYERN
else if (displayName === 'Mesut Ozil') firstWordLength = 5; // MESUT
else if (displayName === 'Arda Guler') firstWordLength = 4; // ARDA
else if (displayName === 'Luka Modric') firstWordLength = 4; // LUKA
else if (displayName === 'Vinicius Junior') firstWordLength = 8; // VINICIUS
else if (displayName === 'Lamin Yemal') firstWordLength = 5; // LAMIN
else if (displayName === 'Clash of Clans') firstWordLength = 5; // CLASH (first word before "OF")
else if (displayName === 'Clash Royale') firstWordLength = 5; // CLASH
else if (displayName === 'Candy Crush') firstWordLength = 5; // CANDY
else if (displayName === 'Pokemon Go') firstWordLength = 7; // POKEMON
else if (displayName === 'Subway Surfers') firstWordLength = 6; // SUBWAY
else if (displayName === 'Temple Run') firstWordLength = 6; // TEMPLE
else if (displayName === 'Angry Birds') firstWordLength = 5; // ANGRY
else if (displayName === 'Counter Strike') firstWordLength = 7; // COUNTER
else if (displayName === 'League of Legends') firstWordLength = 6; // LEAGUE (first word before "OF")
else if (displayName === 'Dota 2') firstWordLength = 4; // DOTA
else if (displayName === 'World of Warcraft') firstWordLength = 5; // WORLD (first word before "OF")
else if (displayName === 'Apex Legends') firstWordLength = 4; // APEX
else if (displayName === 'Call of Duty') firstWordLength = 4; // CALL (first word before "OF")
else if (displayName === 'Grand Theft Auto') firstWordLength = 5; // GRAND (first word before "THEFT")
else if (displayName === 'Among Us') firstWordLength = 5; // AMONG
wordBoundaries.push(firstWordLength);
}
// Calculate total width including word gaps
var totalSlots = answerLength;
var totalGaps = wordBoundaries.length * wordGap;
var totalWidth = (totalSlots - 1) * slotSpacing + totalGaps;
var startX = 1024 - totalWidth / 2;
// Create slots with word separation
var currentX = startX;
for (var i = 0; i < answerLength; i++) {
var slot = new AnswerSlot(i);
slot.x = currentX;
slot.y = 900;
answerSlots.push(slot);
game.addChild(slot);
// Add extra space after word boundaries
currentX += slotSpacing;
for (var w = 0; w < wordBoundaries.length; w++) {
if (i === wordBoundaries[w] - 1) {
currentX += wordGap;
break;
}
}
}
// Create letter tiles
createLetterTiles(currentAnswer);
// Restore any existing hint letters from storage
var logoKey = currentCategory + '_' + currentLogo.name;
for (var i = 0; i < answerSlots.length; i++) {
var hintKey = logoKey + '_hint_' + i;
var hintLetter = storage[hintKey];
if (hintLetter) {
// Find the corresponding letter tile
for (var j = 0; j < letterTiles.length; j++) {
var tile = letterTiles[j];
if (tile.letter === hintLetter && !tile.isPlaced) {
placeLetter(tile, answerSlots[i]);
// Mark as hint letter with green color
answerSlots[i].letterCopy.isHintLetter = true;
answerSlots[i].letterCopy.letterText.fill = 0x00FF00;
answerSlots[i].letterCopy.letterText.tint = 0x00FF00;
// Create green background for hint letter
var hintBackground = LK.getAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
hintBackground.tint = 0x00FF00; // Green background
hintBackground.x = answerSlots[i].x;
hintBackground.y = answerSlots[i].y;
answerSlots[i].hintBackground = hintBackground;
game.addChild(hintBackground);
// Move letter copy to front
game.removeChild(answerSlots[i].letterCopy);
game.addChild(answerSlots[i].letterCopy);
break;
}
}
}
}
// Hint button
var hintBtn = new HintButton();
hintBtn.x = 1024;
hintBtn.y = 1200;
game.addChild(hintBtn);
// Exit button
var exitBtn = new ExitButton();
exitBtn.x = 1848; // Position in top right area, below coins
exitBtn.y = 350; // Further below the coin display
game.addChild(exitBtn);
updateCoinDisplay();
}
// Pre-allocated letter pool for reuse
var letterPool = [];
var poolIndex = 0;
function createLetterTiles(answer) {
// Clear existing tiles efficiently
for (var i = 0; i < letterTiles.length; i++) {
letterTiles[i].destroy();
}
letterTiles.length = 0;
poolIndex = 0;
var letters = answer.split('');
var decoyLetters = ['X', 'Z', 'Q', 'J', 'K', 'W', 'V', 'Y', 'H', 'P', 'C', 'U', 'N', 'D', 'F', 'B', 'G', 'M', 'R', 'S'];
var allLetters = letters.slice(); // Copy answer letters
// Add decoy letters to reach exactly 12 total letters
var decoyCount = 12 - letters.length;
if (decoyCount > 0) {
// Add decoy letters, cycling through the expanded decoy array if needed
for (var d = 0; d < decoyCount; d++) {
allLetters.push(decoyLetters[d % decoyLetters.length]);
}
}
// If answer is longer than 12, just use the first 12 letters
if (allLetters.length > 12) {
allLetters = allLetters.slice(0, 12);
}
// Shuffle letters using optimized Fisher-Yates
for (var i = allLetters.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
if (i !== j) {
var temp = allLetters[i];
allLetters[i] = allLetters[j];
allLetters[j] = temp;
}
}
// Create tiles with object pooling
var cols = 5;
var startX = 1024 - (cols - 1) * 80;
var startY = 1450;
for (var i = 0; i < allLetters.length; i++) {
var tile = new LetterTile(allLetters[i]);
var posX = startX + i % cols * 160;
var posY = startY + Math.floor(i / cols) * 160;
tile.x = posX;
tile.y = posY;
// Store original position for reset functionality
tile.originalX = posX;
tile.originalY = posY;
// Ensure tile is visible
tile.alpha = 1;
tile.visible = true;
letterTiles.push(tile);
game.addChild(tile);
}
}
function createBackButton() {
// Back button functionality removed
}
function updateCoinDisplay() {
if (coinDisplay) {
coinDisplay.parent.removeChild(coinDisplay);
}
coinDisplay = new Container();
var coinIcon = coinDisplay.addChild(LK.getAsset('coinIcon', {
anchorX: 0.5,
anchorY: 0.5
}));
var coinText = new Text2(goldCoins.toString(), {
size: 60,
fill: 0xFFD700
});
coinText.anchor.set(1, 0.5);
coinText.x = -50;
coinDisplay.addChild(coinText);
coinDisplay.x = -80;
coinDisplay.y = 150;
LK.gui.topRight.addChild(coinDisplay);
}
function useHint() {
if (goldCoins < 3 || !currentLogo) {
return;
}
goldCoins -= 3;
storage.goldCoins = goldCoins;
currentLogoUsedHint = true;
updateCoinDisplay();
// Get the appropriate answer based on language and category
var hintAnswer = currentLogo.answer;
if (currentCategory === 'Flags' && currentLanguage === 'tr' && currentLogo.answerTR) {
hintAnswer = currentLogo.answerTR;
}
// Find all empty slots first
var emptySlots = [];
for (var i = 0; i < answerSlots.length; i++) {
var slot = answerSlots[i];
if (!slot.occupiedLetter) {
emptySlots.push({
slot: slot,
index: i
});
}
}
// If no empty slots, return
if (emptySlots.length === 0) {
return;
}
// Pick the first empty slot
var targetSlotInfo = emptySlots[0];
var correctLetter = hintAnswer[targetSlotInfo.index];
// Find the letter tile
for (var j = 0; j < letterTiles.length; j++) {
var tile = letterTiles[j];
if (tile.letter === correctLetter && !tile.isPlaced) {
placeLetter(tile, targetSlotInfo.slot);
// Mark this as a hint letter - permanent and different color
targetSlotInfo.slot.letterCopy.isHintLetter = true;
targetSlotInfo.slot.letterCopy.letterText.fill = 0x00FF00; // Green color for hint letters
targetSlotInfo.slot.letterCopy.letterText.tint = 0x00FF00; // Apply green tint as well
// Create green background for hint letter
var hintBackground = LK.getAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
hintBackground.tint = 0x00FF00; // Green background
hintBackground.x = targetSlotInfo.slot.x;
hintBackground.y = targetSlotInfo.slot.y;
targetSlotInfo.slot.hintBackground = hintBackground;
game.addChild(hintBackground);
// Move letter copy to front
game.removeChild(targetSlotInfo.slot.letterCopy);
game.addChild(targetSlotInfo.slot.letterCopy);
// Store hint letter data persistently
var logoKey = currentCategory + '_' + currentLogo.name;
var hintKey = logoKey + '_hint_' + targetSlotInfo.index;
storage[hintKey] = correctLetter;
break;
}
}
checkAnswer();
}
function removeLetter(letter) {
if (!letter.isPlaced || !letter.targetSlot) {
return;
}
var slot = letter.targetSlot;
// Check if this is a hint letter - if so, don't remove it
if (slot.letterCopy && slot.letterCopy.isHintLetter) {
return; // Cannot remove hint letters
}
// Clear slot
slot.occupiedLetter = null;
// Remove letter copy from answer slot
if (slot.letterCopy) {
if (slot.hintBackground) {
slot.hintBackground.destroy();
slot.hintBackground = null;
}
slot.letterCopy.destroy();
slot.letterCopy = null;
}
// Reset letter to original state
letter.isPlaced = false;
letter.targetSlot = null;
letter.alpha = 1;
letter.x = letter.originalX;
letter.y = letter.originalY;
}
function placeLetter(letter, slot) {
if (slot.occupiedLetter) {
// Check if the current letter in slot is a hint letter - if so, don't replace it
if (slot.letterCopy && slot.letterCopy.isHintLetter) {
return; // Cannot replace hint letters
}
// Return previous letter to pool
var prevLetter = slot.occupiedLetter;
prevLetter.isPlaced = false;
prevLetter.targetSlot = null;
prevLetter.alpha = 1;
// Remove the letter copy from answer slot
if (slot.letterCopy) {
if (slot.hintBackground) {
slot.hintBackground.destroy();
slot.hintBackground = null;
}
slot.letterCopy.destroy();
slot.letterCopy = null;
}
prevLetter.x = prevLetter.originalX;
prevLetter.y = prevLetter.originalY;
}
letter.isPlaced = true;
letter.targetSlot = slot;
slot.occupiedLetter = letter;
// Make the original tile appear faded/hidden
letter.alpha = 0.3;
// Create a copy of the letter in the answer slot
var letterCopy = new LetterTile(letter.letter);
letterCopy.x = slot.x;
letterCopy.y = slot.y;
letterCopy.isPlaced = true;
letterCopy.isHintLetter = false; // Initialize as not a hint letter
letterCopy.down = function (x, y, obj) {
// Only allow removal if not a hint letter
if (!letterCopy.isHintLetter) {
removeLetter(letter);
}
};
slot.letterCopy = letterCopy;
game.addChild(letterCopy);
}
function showSettings() {
game.removeChildren();
gameState = 'settings';
// Settings title
var title = new Text2(languageTexts[currentLanguage].settings, {
size: 120,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
game.addChild(title);
// Language section title
var langTitle = new Text2(languageTexts[currentLanguage].language, {
size: 80,
fill: 0xFFD700
});
langTitle.anchor.set(0.5, 0.5);
langTitle.x = 1024;
langTitle.y = 600;
game.addChild(langTitle);
// Turkish language button
var turkishButton = new CategoryButton(languageTexts[currentLanguage].turkish);
turkishButton.x = 700;
turkishButton.y = 750;
if (currentLanguage === 'tr') {
turkishButton.alpha = 1.0; // Fully visible when selected
} else {
turkishButton.alpha = 0.6; // Dimmed when not selected
}
turkishButton.down = function (x, y, obj) {
turkishButton.scaleX = 0.95;
turkishButton.scaleY = 0.95;
currentLanguage = 'tr';
storage.currentLanguage = currentLanguage;
showSettings(); // Refresh settings screen
};
turkishButton.up = function (x, y, obj) {
turkishButton.scaleX = 1;
turkishButton.scaleY = 1;
};
game.addChild(turkishButton);
// English language button
var englishButton = new CategoryButton(languageTexts[currentLanguage].english);
englishButton.x = 1348;
englishButton.y = 750;
if (currentLanguage === 'en') {
englishButton.alpha = 1.0; // Fully visible when selected
} else {
englishButton.alpha = 0.6; // Dimmed when not selected
}
englishButton.down = function (x, y, obj) {
englishButton.scaleX = 0.95;
englishButton.scaleY = 0.95;
currentLanguage = 'en';
storage.currentLanguage = currentLanguage;
showSettings(); // Refresh settings screen
};
englishButton.up = function (x, y, obj) {
englishButton.scaleX = 1;
englishButton.scaleY = 1;
};
game.addChild(englishButton);
// Reset data button
var resetButton = new CategoryButton(languageTexts[currentLanguage].resetData);
resetButton.x = 1024;
resetButton.y = 950;
resetButton.down = function (x, y, obj) {
resetButton.scaleX = 0.95;
resetButton.scaleY = 0.95;
showResetConfirmation();
};
resetButton.up = function (x, y, obj) {
resetButton.scaleX = 1;
resetButton.scaleY = 1;
};
game.addChild(resetButton);
// Back to menu button
var backButton = new CategoryButton(languageTexts[currentLanguage].backToMenu);
backButton.x = 1024;
backButton.y = 1200;
backButton.down = function (x, y, obj) {
backButton.scaleX = 0.95;
backButton.scaleY = 0.95;
initializeMenu();
};
backButton.up = function (x, y, obj) {
backButton.scaleX = 1;
backButton.scaleY = 1;
};
game.addChild(backButton);
updateCoinDisplay();
}
function showResetConfirmation() {
game.removeChildren();
gameState = 'resetConfirm';
// Confirmation title
var title = new Text2(languageTexts[currentLanguage].resetConfirm, {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 500;
game.addChild(title);
// Warning text showing what will be deleted - with better spacing
var warningText1 = new Text2('Silinecek veriler:', {
size: 80,
fill: 0xFF0000
});
warningText1.anchor.set(0.5, 0.5);
warningText1.x = 1024;
warningText1.y = 680;
game.addChild(warningText1);
var warningText2 = new Text2('• Tüm çözülmüş logolar', {
size: 65,
fill: 0xFF0000
});
warningText2.anchor.set(0.5, 0.5);
warningText2.x = 1024;
warningText2.y = 770;
game.addChild(warningText2);
var warningText3 = new Text2('• Kategori ilerlemeleri', {
size: 65,
fill: 0xFF0000
});
warningText3.anchor.set(0.5, 0.5);
warningText3.x = 1024;
warningText3.y = 840;
game.addChild(warningText3);
var warningText4 = new Text2('• İpucu verileri', {
size: 65,
fill: 0xFF0000
});
warningText4.anchor.set(0.5, 0.5);
warningText4.x = 1024;
warningText4.y = 910;
game.addChild(warningText4);
var warningText5 = new Text2('(Altın coinler korunacak)', {
size: 55,
fill: 0xFFD700
});
warningText5.anchor.set(0.5, 0.5);
warningText5.x = 1024;
warningText5.y = 1000;
game.addChild(warningText5);
// Yes button - positioned further left for better separation
var yesButton = new CategoryButton(languageTexts[currentLanguage].yes);
yesButton.x = 600;
yesButton.y = 1100;
// Make button smaller for better visual balance
yesButton.scaleX = 0.8;
yesButton.scaleY = 0.8;
yesButton.down = function (x, y, obj) {
yesButton.scaleX = 0.75;
yesButton.scaleY = 0.75;
// Reset all game progress except coins
storage.completedLogos = {};
completedLogos = {};
storage.completedWithoutHints = {};
completedWithoutHints = {};
storage.categoryCompletions = {
'Technology': 0,
'Football': 0,
'Cars': 0,
'Food': 0,
'Footballers': 0,
'Flags': 0,
'Games': 0
};
categoryCompletions = {
'Technology': 0,
'Football': 0,
'Cars': 0,
'Food': 0,
'Footballers': 0,
'Flags': 0,
'Games': 0
};
// Clear all hint letters from storage - properly iterate through storage keys
var storageKeysToDelete = [];
for (var key in storage) {
if (key.indexOf('_hint_') !== -1) {
storageKeysToDelete.push(key);
}
}
// Delete all hint keys
for (var k = 0; k < storageKeysToDelete.length; k++) {
delete storage[storageKeysToDelete[k]];
}
// Flash screen to show reset happened
LK.effects.flashScreen(0xFF0000, 500);
// Go back to main menu after reset
LK.setTimeout(function () {
initializeMenu();
}, 1000);
};
yesButton.up = function (x, y, obj) {
yesButton.scaleX = 0.8;
yesButton.scaleY = 0.8;
};
game.addChild(yesButton);
// No button - positioned further right for better separation
var noButton = new CategoryButton(languageTexts[currentLanguage].no);
noButton.x = 1448;
noButton.y = 1100;
// Make button smaller for better visual balance
noButton.scaleX = 0.8;
noButton.scaleY = 0.8;
noButton.down = function (x, y, obj) {
noButton.scaleX = 0.75;
noButton.scaleY = 0.75;
showSettings();
};
noButton.up = function (x, y, obj) {
noButton.scaleX = 0.8;
noButton.scaleY = 0.8;
};
game.addChild(noButton);
updateCoinDisplay();
}
function showCompletedLogo(logoData) {
game.removeChildren();
gameState = 'completed';
currentLogo = logoData;
// Logo display area - larger and more prominent visual logo
var logoAssetName = logoData.name.toLowerCase() + 'Logo';
if (logoData.name === 'Real Madrid') {
logoAssetName = 'realmadridLogo';
}
if (logoData.name === 'Manchester United') {
logoAssetName = 'manchesterLogo';
}
if (logoData.name === 'McDonalds') {
logoAssetName = 'mcdonaldsLogo';
}
if (logoData.name === 'Pizza Hut') {
logoAssetName = 'pizzahutLogo';
}
if (logoData.name === 'Instagram') {
logoAssetName = 'instagramLogo';
}
if (logoData.name === 'TikTok') {
logoAssetName = 'tiktokLogo';
}
if (logoData.name === 'Burger King') {
logoAssetName = 'burgerkingLogo';
}
if (logoData.name === 'Bayern München') {
logoAssetName = 'bayernmunchenLogo';
}
if (logoData.name === 'Galatasaray') {
logoAssetName = 'galatasarayLogo';
}
if (logoData.name === 'Tesla') {
logoAssetName = 'teslaLogo';
}
if (logoData.name === 'Lamborghini') {
logoAssetName = 'lamborghiniLogo';
}
if (logoData.name === 'Tog') {
logoAssetName = 'togLogo';
}
if (logoData.name === 'ChatGPT') {
logoAssetName = 'chatgptLogo';
}
if (logoData.name === 'Xiaomi') {
logoAssetName = 'xiaomiLogo';
}
if (logoData.name === 'Twitter') {
logoAssetName = 'xLogo';
}
if (logoData.name === 'YouTube') {
logoAssetName = 'youtubeLogo';
}
if (logoData.name === 'Netflix') {
logoAssetName = 'netflixLogo';
}
if (logoData.name === 'Spotify') {
logoAssetName = 'spotifyLogo';
}
if (logoData.name === 'WhatsApp') {
logoAssetName = 'whatsappLogo';
}
if (logoData.name === 'Telegram') {
logoAssetName = 'telegramLogo';
}
if (logoData.name === 'Discord') {
logoAssetName = 'discordLogo';
}
if (logoData.name === 'Zoom') {
logoAssetName = 'zoomLogo';
}
if (logoData.name === 'Skype') {
logoAssetName = 'skypeLogo';
}
if (logoData.name === 'PayPal') {
logoAssetName = 'paypalLogo';
}
if (logoData.name === 'Amazon') {
logoAssetName = 'amazonLogo';
}
if (logoData.name === 'eBay') {
logoAssetName = 'ebayLogo';
}
if (logoData.name === 'Uber') {
logoAssetName = 'uberLogo';
}
if (logoData.name === 'Airbnb') {
logoAssetName = 'airbnbLogo';
}
// Footballers category assets
if (logoData.name === 'Messi') {
logoAssetName = 'messiLogo';
}
if (logoData.name === 'Ronaldo') {
logoAssetName = 'ronaldoLogo';
}
if (logoData.name === 'Neymar') {
logoAssetName = 'neymarLogo';
}
if (logoData.name === 'Mbappe') {
logoAssetName = 'mbappeLogo';
}
if (logoData.name === 'Haaland') {
logoAssetName = 'haalandLogo';
}
if (logoData.name === 'Benzema') {
logoAssetName = 'benzemaLogo';
}
if (logoData.name === 'Lewandowski') {
logoAssetName = 'lewandowskiLogo';
}
if (logoData.name === 'Mesut Ozil') {
logoAssetName = 'mesutoezilLogo';
}
if (logoData.name === 'Arda Guler') {
logoAssetName = 'ardagulerLogo';
}
if (logoData.name === 'Luka Modric') {
logoAssetName = 'lukamodricLogo';
}
if (logoData.name === 'Vinicius Junior') {
logoAssetName = 'viniciusjuniorLogo';
}
if (logoData.name === 'Erling Haaland') {
logoAssetName = 'erlinghaalandLogo';
}
if (logoData.name === 'Lamin Yemal') {
logoAssetName = 'laminyemalLogo';
}
// Flags category assets
if (logoData.name === 'Turkey') {
logoAssetName = 'turkeyLogo';
}
if (logoData.name === 'Germany') {
logoAssetName = 'germanyLogo';
}
if (logoData.name === 'France') {
logoAssetName = 'franceLogo';
}
if (logoData.name === 'Spain') {
logoAssetName = 'spainLogo';
}
if (logoData.name === 'Italy') {
logoAssetName = 'italyLogo';
}
if (logoData.name === 'Brazil') {
logoAssetName = 'brazilLogo';
}
if (logoData.name === 'Argentina') {
logoAssetName = 'argentinaLogo';
}
if (logoData.name === 'England') {
logoAssetName = 'englandLogo';
}
if (logoData.name === 'Portugal') {
logoAssetName = 'portugalLogo';
}
if (logoData.name === 'Netherlands') {
logoAssetName = 'netherlandsLogo';
}
if (logoData.name === 'Russia') {
logoAssetName = 'russiaLogo';
}
if (logoData.name === 'Japan') {
logoAssetName = 'japanLogo';
}
if (logoData.name === 'South Korea') {
logoAssetName = 'southkoreaLogo';
}
if (logoData.name === 'Mexico') {
logoAssetName = 'mexicoLogo';
}
if (logoData.name === 'Canada') {
logoAssetName = 'canadaLogo';
}
if (logoData.name === 'Australia') {
logoAssetName = 'australiaLogo';
}
if (logoData.name === 'Greece') {
logoAssetName = 'greeceLogo';
}
if (logoData.name === 'Belgium') {
logoAssetName = 'belgiumLogo';
}
if (logoData.name === 'Croatia') {
logoAssetName = 'croatiaLogo';
}
if (logoData.name === 'Poland') {
logoAssetName = 'polandLogo';
}
if (logoData.name === 'Sweden') {
logoAssetName = 'swedenLogo';
}
// Games category assets
if (logoData.name === 'Minecraft') {
logoAssetName = 'minecraftLogo';
}
if (logoData.name === 'Fortnite') {
logoAssetName = 'fortniteLogo';
}
if (logoData.name === 'PUBG') {
logoAssetName = 'pubgLogo';
}
if (logoData.name === 'Among Us') {
logoAssetName = 'amongusLogo';
}
if (logoData.name === 'Clash of Clans') {
logoAssetName = 'clashofclansLogo';
}
if (logoData.name === 'Clash Royale') {
logoAssetName = 'clashroyaleLogo';
}
if (logoData.name === 'Candy Crush') {
logoAssetName = 'candycrushLogo';
}
if (logoData.name === 'Pokemon Go') {
logoAssetName = 'pokemongoLogo';
}
if (logoData.name === 'Subway Surfers') {
logoAssetName = 'subwaysurfersLogo';
}
if (logoData.name === 'Temple Run') {
logoAssetName = 'templerunLogo';
}
if (logoData.name === 'Angry Birds') {
logoAssetName = 'angrybirdsLogo';
}
if (logoData.name === 'Roblox') {
logoAssetName = 'robloxLogo';
}
if (logoData.name === 'Counter Strike') {
logoAssetName = 'counterstrikeLogo';
}
if (logoData.name === 'League of Legends') {
logoAssetName = 'leagueoflegendsLogo';
}
if (logoData.name === 'Dota 2') {
logoAssetName = 'dota2Logo';
}
if (logoData.name === 'World of Warcraft') {
logoAssetName = 'worldofwarcraftLogo';
}
if (logoData.name === 'Valorant') {
logoAssetName = 'valorantLogo';
}
if (logoData.name === 'Apex Legends') {
logoAssetName = 'apexlegendsLogo';
}
if (logoData.name === 'Call of Duty') {
logoAssetName = 'callofdutyLogo';
}
if (logoData.name === 'Grand Theft Auto') {
logoAssetName = 'grandtheftautoLogo';
}
if (logoData.name === 'Overwatch') {
logoAssetName = 'overwatchLogo';
}
if (logoData.name === 'Steam') {
logoAssetName = 'steamLogo';
}
var logoVisual = LK.getAsset(logoAssetName, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
logoVisual.x = 1024;
logoVisual.y = 500;
game.addChild(logoVisual);
// Show "COMPLETED" text
var completedText = new Text2(languageTexts[currentLanguage].completedText, {
size: 100,
fill: 0x00FF00
});
completedText.anchor.set(0.5, 0.5);
completedText.x = 1024;
completedText.y = 800;
game.addChild(completedText);
// Show the answer
var displayName = logoData.name;
if (logoData.name === 'Burger King') {
displayName = 'Burger King'; // Ensure space between Burger and King
}
if (logoData.name === 'Real Madrid') {
displayName = 'Real Madrid';
}
if (logoData.name === 'Manchester United') {
displayName = 'Manchester United';
}
if (logoData.name === 'Pizza Hut') {
displayName = 'Pizza Hut';
}
if (logoData.name === 'Bayern München') {
displayName = 'Bayern München';
}
if (logoData.name === 'Mesut Ozil') {
displayName = 'Mesut Özil';
}
if (logoData.name === 'Arda Guler') {
displayName = 'Arda Güler';
}
if (logoData.name === 'Luka Modric') {
displayName = 'Luka Modrić';
}
if (logoData.name === 'Vinicius Junior') {
displayName = 'Vinícius Jr.';
}
if (logoData.name === 'Erling Haaland') {
displayName = 'Erling Haaland';
}
if (logoData.name === 'Lamin Yemal') {
displayName = 'Lamine Yamal';
}
var answerText = new Text2(displayName, {
size: 80,
fill: 0xFFFFFF
});
answerText.anchor.set(0.5, 0.5);
answerText.x = 1024;
answerText.y = 900;
game.addChild(answerText);
// Show coin reward text
var coinRewardText = new Text2('+10', {
size: 60,
fill: 0xFFD700
});
coinRewardText.anchor.set(0.5, 0.5);
coinRewardText.x = 1024;
coinRewardText.y = 950;
game.addChild(coinRewardText);
// Add checkmark
var checkmark = LK.getAsset('checkmark', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
checkmark.x = 1024;
checkmark.y = 1050;
game.addChild(checkmark);
// Exit button
var exitBtn = new ExitButton();
exitBtn.x = 1024;
exitBtn.y = 1300;
exitBtn.down = function (x, y, obj) {
exitBtn.scaleX = 0.95;
exitBtn.scaleY = 0.95;
showCategoryLogos(currentCategory); // Return to category view
};
exitBtn.up = function (x, y, obj) {
exitBtn.scaleX = 1;
exitBtn.scaleY = 1;
};
game.addChild(exitBtn);
updateCoinDisplay();
}
function checkAnswer() {
var playerAnswer = '';
for (var i = 0; i < answerSlots.length; i++) {
var slot = answerSlots[i];
if (slot.occupiedLetter) {
playerAnswer += slot.occupiedLetter.letter;
} else {
return; // Not all slots filled
}
}
// Get the appropriate answer based on language and category
var correctAnswer = currentLogo.answer;
if (currentCategory === 'Flags' && currentLanguage === 'tr' && currentLogo.answerTR) {
correctAnswer = currentLogo.answerTR;
}
if (playerAnswer === correctAnswer) {
// Correct answer
goldCoins += 20;
storage.goldCoins = goldCoins;
// Mark logo as completed
var logoKey = currentCategory + '_' + currentLogo.name;
if (!completedLogos[logoKey]) {
completedLogos[logoKey] = true;
storage.completedLogos = completedLogos;
// Only count towards hint-free completion tracking if no hint was used
if (!currentLogoUsedHint) {
completedWithoutHints[logoKey] = true;
storage.completedWithoutHints = completedWithoutHints;
}
// Update category completions - count all completed logos for category unlocking
updateCategoryCompletions();
}
LK.getSound('correctAnswer').play();
LK.getSound('coinEarned').play();
LK.effects.flashScreen(0x00FF00, 500);
LK.setTimeout(function () {
showCategoryLogos(currentCategory);
}, 1000);
} else {
// Wrong answer - flash all answer slots red using optimized method
var wrongAnswerSlots = [];
for (var j = 0; j < answerSlots.length; j++) {
if (answerSlots[j] && answerSlots[j].letterCopy) {
wrongAnswerSlots.push(answerSlots[j].letterCopy);
}
}
// Batch tween operations for better performance
if (wrongAnswerSlots.length > 0) {
for (var k = 0; k < wrongAnswerSlots.length; k++) {
var letterRef = wrongAnswerSlots[k];
letterRef.tint = 0xFF0000;
// Use single tween back to normal instead of chained tweens
tween(letterRef, {
tint: 0xFFFFFF
}, {
duration: 500,
delay: 200
});
}
}
// Also flash the screen red briefly
LK.effects.flashScreen(0xFF0000, 300);
}
}
function handleMove(x, y, obj) {
// Move handler no longer needed for letter dragging
}
game.move = handleMove;
game.up = function (x, y, obj) {
// Up handler no longer needed for letter dragging
};
// Performance optimization variables
var lastFrameTime = 0;
var targetFPS = 60;
var frameInterval = 1000 / targetFPS;
// Optimize memory management
var memoryCleanupCounter = 0;
game.update = function () {
// Limit frame rate for stability
var currentTime = Date.now();
if (currentTime - lastFrameTime < frameInterval) {
return;
}
lastFrameTime = currentTime;
// Periodic memory cleanup
memoryCleanupCounter++;
if (memoryCleanupCounter > 300) {
// Every 5 seconds at 60fps
memoryCleanupCounter = 0;
// Force garbage collection hints
if (window.gc) {
window.gc();
}
}
};
// Welcome menu state
function showWelcomeMenu() {
game.removeChildren();
gameState = 'welcome';
// Title
var title = new Text2('Logo Quiz', {
size: 150,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 600;
game.addChild(title);
// Subtitle
var subtitle = new Text2('Hoşgeldiniz!', {
size: 100,
fill: 0xFFD700
});
subtitle.anchor.set(0.5, 0.5);
subtitle.x = 1024;
subtitle.y = 750;
game.addChild(subtitle);
// Play button
var playButton = new CategoryButton('Oynamaya Başla');
playButton.x = 1024;
playButton.y = 1050;
playButton.down = function (x, y, obj) {
playButton.scaleX = 0.95;
playButton.scaleY = 0.95;
showCategorySelection();
};
playButton.up = function (x, y, obj) {
playButton.scaleX = 1;
playButton.scaleY = 1;
};
game.addChild(playButton);
// Warning text about logo colors
var warningText = new Text2('Tüm logoların resmi olmayabilir', {
size: 65,
//{pv_1}
fill: 0xFF0000 //{pv_2}
}); //{pv_3}
warningText.anchor.set(0.5, 0.5); //{pv_4}
warningText.x = 1024; //{pv_5}
warningText.y = 1250; //{pv_6}
game.addChild(warningText); //{pv_7}
updateCoinDisplay();
}
// Initialize the game with welcome menu
showWelcomeMenu(); /****
* Plugins
****/
var storage = LK.import("@upit/storage.v1");
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var AnswerSlot = Container.expand(function (index) {
var self = Container.call(this);
var bg = self.attachAsset('answerBox', {
anchorX: 0.5,
anchorY: 0.5
});
self.index = index;
self.occupiedLetter = null;
return self;
});
var CategoryButton = Container.expand(function (category) {
var self = Container.call(this);
var bg = self.attachAsset('categoryButton', {
anchorX: 0.5,
anchorY: 0.5
});
// Set background color based on category
if (category === 'Cars') {
bg.tint = 0x000000; // Black background for Cars (Arabalar)
} else if (category === 'Food') {
bg.tint = 0xFF0000; // Red background for Food (Yemekler)
} else if (category === 'Football') {
bg.tint = 0x00FF00; // Green background for Football (Futbol)
} else if (category === 'Footballers') {
bg.tint = 0x0000FF; // Blue background for Footballers (Futbolcu)
} else if (category === 'Flags') {
bg.tint = 0xFF00FF; // Magenta background for Flags (Bayraqlar)
} else if (category === 'Games') {
bg.tint = 0x800080; // Purple background for Games (Oyunlar)
}
var text = new Text2(category, {
size: 80,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.category = category;
self.down = function (x, y, obj) {
self.scaleX = 0.95;
self.scaleY = 0.95;
showCategoryLogos(self.category);
};
self.up = function (x, y, obj) {
self.scaleX = 1;
self.scaleY = 1;
};
return self;
});
var ExitButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('exitButton', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2('Exit', {
size: 50,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.down = function (x, y, obj) {
self.scaleX = 0.95;
self.scaleY = 0.95;
showCategoryLogos(currentCategory);
};
self.up = function (x, y, obj) {
self.scaleX = 1;
self.scaleY = 1;
};
return self;
});
var HintButton = Container.expand(function () {
var self = Container.call(this);
var bg = self.attachAsset('hintButton', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2('Hint (3 coins)', {
size: 50,
fill: 0xFFFFFF
});
text.anchor.set(0.5, 0.5);
self.addChild(text);
self.down = function (x, y, obj) {
if (goldCoins >= 5) {
useHint();
}
};
return self;
});
var LetterTile = Container.expand(function (letter) {
var self = Container.call(this);
var bg = self.attachAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
var text = new Text2(letter, {
size: 60,
fill: 0x333333
});
text.anchor.set(0.5, 0.5);
// Ensure text is visible and properly positioned
text.x = 0;
text.y = 0;
text.alpha = 1;
text.visible = true;
self.addChild(text);
self.letter = letter;
self.originalX = 0;
self.originalY = 0;
self.isPlaced = false;
self.targetSlot = null;
// Store reference to text for easier access
self.letterText = text;
self.down = function (x, y, obj) {
if (!self.isPlaced) {
// Find next available answer slot
var nextSlot = null;
for (var i = 0; i < answerSlots.length; i++) {
if (!answerSlots[i].occupiedLetter) {
nextSlot = answerSlots[i];
break;
}
}
if (nextSlot) {
placeLetter(self, nextSlot);
checkAnswer();
}
} else {
// Letter is placed, remove it from answer slot
removeLetter(self);
}
};
return self;
});
var LogoButton = Container.expand(function (logoName, logoData) {
var self = Container.call(this);
var bg = self.attachAsset('logoContainer', {
anchorX: 0.5,
anchorY: 0.5
});
// Get logo asset name from company name
var logoAssetName = logoData.name.toLowerCase() + 'Logo';
if (logoData.name === 'Real Madrid') {
logoAssetName = 'realmadridLogo';
}
if (logoData.name === 'Manchester United') {
logoAssetName = 'manchesterLogo';
}
if (logoData.name === 'McDonalds') {
logoAssetName = 'mcdonaldsLogo';
}
if (logoData.name === 'Pizza Hut') {
logoAssetName = 'pizzahutLogo';
}
if (logoData.name === 'Instagram') {
logoAssetName = 'instagramLogo';
}
if (logoData.name === 'TikTok') {
logoAssetName = 'tiktokLogo';
}
if (logoData.name === 'Burger King') {
logoAssetName = 'burgerkingLogo';
}
if (logoData.name === 'Bayern München') {
logoAssetName = 'bayernmunchenLogo';
}
if (logoData.name === 'Galatasaray') {
logoAssetName = 'galatasarayLogo';
}
if (logoData.name === 'Tesla') {
logoAssetName = 'teslaLogo';
}
if (logoData.name === 'Lamborghini') {
logoAssetName = 'lamborghiniLogo';
}
if (logoData.name === 'Tog') {
logoAssetName = 'togLogo';
}
if (logoData.name === 'ChatGPT') {
logoAssetName = 'chatgptLogo';
}
if (logoData.name === 'Xiaomi') {
logoAssetName = 'xiaomiLogo';
}
if (logoData.name === 'Twitter') {
logoAssetName = 'xLogo';
}
if (logoData.name === 'YouTube') {
logoAssetName = 'youtubeLogo';
}
if (logoData.name === 'Netflix') {
logoAssetName = 'netflixLogo';
}
if (logoData.name === 'Spotify') {
logoAssetName = 'spotifyLogo';
}
if (logoData.name === 'WhatsApp') {
logoAssetName = 'whatsappLogo';
}
if (logoData.name === 'Telegram') {
logoAssetName = 'telegramLogo';
}
if (logoData.name === 'Discord') {
logoAssetName = 'discordLogo';
}
if (logoData.name === 'Zoom') {
logoAssetName = 'zoomLogo';
}
if (logoData.name === 'Skype') {
logoAssetName = 'skypeLogo';
}
if (logoData.name === 'PayPal') {
logoAssetName = 'paypalLogo';
}
if (logoData.name === 'Amazon') {
logoAssetName = 'amazonLogo';
}
if (logoData.name === 'eBay') {
logoAssetName = 'ebayLogo';
}
if (logoData.name === 'Uber') {
logoAssetName = 'uberLogo';
}
if (logoData.name === 'Airbnb') {
logoAssetName = 'airbnbLogo';
}
// Footballers category assets
if (logoData.name === 'Messi') {
logoAssetName = 'messiLogo';
}
if (logoData.name === 'Ronaldo') {
logoAssetName = 'ronaldoLogo';
}
if (logoData.name === 'Neymar') {
logoAssetName = 'neymarLogo';
}
if (logoData.name === 'Mbappe') {
logoAssetName = 'mbappeLogo';
}
if (logoData.name === 'Haaland') {
logoAssetName = 'haalandLogo';
}
if (logoData.name === 'Benzema') {
logoAssetName = 'benzemaLogo';
}
if (logoData.name === 'Lewandowski') {
logoAssetName = 'lewandowskiLogo';
}
if (logoData.name === 'Mesut Ozil') {
logoAssetName = 'mesutoezilLogo';
}
if (logoData.name === 'Arda Guler') {
logoAssetName = 'ardagulerLogo';
}
if (logoData.name === 'Luka Modric') {
logoAssetName = 'lukamodricLogo';
}
if (logoData.name === 'Vinicius Junior') {
logoAssetName = 'viniciusjuniorLogo';
}
if (logoData.name === 'Erling Haaland') {
logoAssetName = 'erlinghaalandLogo';
}
if (logoData.name === 'Lamin Yemal') {
logoAssetName = 'laminyemalLogo';
}
// Flags category assets
if (logoData.name === 'Turkey') {
logoAssetName = 'turkeyLogo';
}
if (logoData.name === 'Germany') {
logoAssetName = 'germanyLogo';
}
if (logoData.name === 'France') {
logoAssetName = 'franceLogo';
}
if (logoData.name === 'Spain') {
logoAssetName = 'spainLogo';
}
if (logoData.name === 'Italy') {
logoAssetName = 'italyLogo';
}
if (logoData.name === 'Brazil') {
logoAssetName = 'brazilLogo';
}
if (logoData.name === 'Argentina') {
logoAssetName = 'argentinaLogo';
}
if (logoData.name === 'England') {
logoAssetName = 'englandLogo';
}
if (logoData.name === 'Portugal') {
logoAssetName = 'portugalLogo';
}
if (logoData.name === 'Netherlands') {
logoAssetName = 'netherlandsLogo';
}
if (logoData.name === 'Russia') {
logoAssetName = 'russiaLogo';
}
if (logoData.name === 'Japan') {
logoAssetName = 'japanLogo';
}
if (logoData.name === 'South Korea') {
logoAssetName = 'southkoreaLogo';
}
if (logoData.name === 'Mexico') {
logoAssetName = 'mexicoLogo';
}
if (logoData.name === 'Canada') {
logoAssetName = 'canadaLogo';
}
if (logoData.name === 'Australia') {
logoAssetName = 'australiaLogo';
}
if (logoData.name === 'Greece') {
logoAssetName = 'greeceLogo';
}
if (logoData.name === 'Belgium') {
logoAssetName = 'belgiumLogo';
}
if (logoData.name === 'Croatia') {
logoAssetName = 'croatiaLogo';
}
if (logoData.name === 'Poland') {
logoAssetName = 'polandLogo';
}
if (logoData.name === 'Sweden') {
logoAssetName = 'swedenLogo';
}
// Games category assets
if (logoData.name === 'Minecraft') {
logoAssetName = 'minecraftLogo';
}
if (logoData.name === 'Fortnite') {
logoAssetName = 'fortniteLogo';
}
if (logoData.name === 'PUBG') {
logoAssetName = 'pubgLogo';
}
if (logoData.name === 'Among Us') {
logoAssetName = 'amongusLogo';
}
if (logoData.name === 'Clash of Clans') {
logoAssetName = 'clashofclansLogo';
}
if (logoData.name === 'Clash Royale') {
logoAssetName = 'clashroyaleLogo';
}
if (logoData.name === 'Candy Crush') {
logoAssetName = 'candycrushLogo';
}
if (logoData.name === 'Pokemon Go') {
logoAssetName = 'pokemongoLogo';
}
if (logoData.name === 'Subway Surfers') {
logoAssetName = 'subwaysurfersLogo';
}
if (logoData.name === 'Temple Run') {
logoAssetName = 'templerunLogo';
}
if (logoData.name === 'Angry Birds') {
logoAssetName = 'angrybirdsLogo';
}
if (logoData.name === 'Roblox') {
logoAssetName = 'robloxLogo';
}
if (logoData.name === 'Counter Strike') {
logoAssetName = 'counterstrikeLogo';
}
if (logoData.name === 'League of Legends') {
logoAssetName = 'leagueoflegendsLogo';
}
if (logoData.name === 'Dota 2') {
logoAssetName = 'dota2Logo';
}
if (logoData.name === 'World of Warcraft') {
logoAssetName = 'worldofwarcraftLogo';
}
if (logoData.name === 'Valorant') {
logoAssetName = 'valorantLogo';
}
if (logoData.name === 'Apex Legends') {
logoAssetName = 'apexlegendsLogo';
}
if (logoData.name === 'Call of Duty') {
logoAssetName = 'callofdutyLogo';
}
if (logoData.name === 'Grand Theft Auto') {
logoAssetName = 'grandtheftautoLogo';
}
if (logoData.name === 'Overwatch') {
logoAssetName = 'overwatchLogo';
}
if (logoData.name === 'Steam') {
logoAssetName = 'steamLogo';
}
var logoVisual = self.attachAsset(logoAssetName, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
self.logoData = logoData;
self.down = function (x, y, obj) {
// Check if logo is completed
var logoKey = currentCategory + '_' + self.logoData.name;
if (completedLogos[logoKey]) {
// Show completed logo name instead of starting the game
showCompletedLogo(self.logoData);
return;
}
self.scaleX = 0.95;
self.scaleY = 0.95;
startLogoGuess(self.logoData);
};
self.up = function (x, y, obj) {
self.scaleX = 1;
self.scaleY = 1;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2C3E50
});
/****
* Game Code
****/
// Game state variables
// Logo assets - Technology
// Logo assets - Football
// Logo assets - Cars
// Logo assets - Food
// Placeholder assets for logos without images - using shapes with category-specific colors
var gameState = 'menu'; // 'menu', 'category', 'guessing'
var goldCoins = storage.goldCoins || 25;
var currentLanguage = storage.currentLanguage || 'tr'; // 'tr' for Turkish, 'en' for English
var completedLogos = storage.completedLogos || {};
var completedWithoutHints = storage.completedWithoutHints || {};
var categoryCompletions = storage.categoryCompletions || {
'Technology': 0,
'Football': 0,
'Cars': 0,
'Food': 0,
'Footballers': 0,
'Flags': 0,
'Games': 0
};
var currentLogoUsedHint = false;
// Recalculate category completions based on completed logos to ensure accuracy
function updateCategoryCompletions() {
// Reset counts
for (var category in categoryCompletions) {
categoryCompletions[category] = 0;
}
// Count ALL completed logos for category unlocking
for (var logoKey in completedLogos) {
if (completedLogos[logoKey]) {
var category = logoKey.split('_')[0];
if (categoryCompletions[category] !== undefined) {
categoryCompletions[category]++;
}
}
}
storage.categoryCompletions = categoryCompletions;
}
// Update completions on game start
updateCategoryCompletions();
var currentCategory = '';
var currentLogo = null;
var draggedLetter = null;
var letterTiles = [];
var answerSlots = [];
var currentAnswer = '';
// Pagination variables for all categories
var TechnologyPage = 0;
var FootballPage = 0;
var CarsPage = 0;
var FoodPage = 0;
var FootballersPage = 0;
var FlagsPage = 0;
var GamesPage = 0;
var logosPerPage = 12;
// Language configuration
var languageTexts = {
tr: {
title: 'Logo Quiz Challenge',
completed: 'Tamamlanan: ',
settings: 'Ayarlar',
language: 'Dil',
turkish: 'Türkçe',
english: 'İngilizce',
resetData: 'Tüm Verileri Sıfırla',
backToMenu: 'Ana Menüye Dön',
resetConfirm: 'Silmek İstediğinden Emin Misin?',
yes: 'Evet',
no: 'Hayır',
completedText: 'TAMAMLANDI'
},
en: {
title: 'Logo Quiz Challenge',
completed: 'Completed: ',
settings: 'Settings',
language: 'Language',
turkish: 'Turkish',
english: 'English',
resetData: 'Reset All Data',
backToMenu: 'Back to Menu',
resetConfirm: 'Are you sure you want to delete?',
yes: 'Yes',
no: 'No',
completedText: 'COMPLETED'
}
};
// Logo data
var logoDatabase = {
'Technology': [{
name: 'Apple',
answer: 'APPLE'
}, {
name: 'Google',
answer: 'GOOGLE'
}, {
name: 'Microsoft',
answer: 'MICROSOFT'
}, {
name: 'Samsung',
answer: 'SAMSUNG'
}, {
name: 'Instagram',
answer: 'INSTAGRAM'
}, {
name: 'TikTok',
answer: 'TIKTOK'
}, {
name: 'ChatGPT',
answer: 'CHATGPT'
}, {
name: 'Xiaomi',
answer: 'XIAOMI'
}, {
name: 'Facebook',
answer: 'FACEBOOK'
}, {
name: 'X',
answer: 'X'
}, {
name: 'YouTube',
answer: 'YOUTUBE'
}, {
name: 'Netflix',
answer: 'NETFLIX'
}, {
name: 'Spotify',
answer: 'SPOTIFY'
}, {
name: 'WhatsApp',
answer: 'WHATSAPP'
}, {
name: 'Telegram',
answer: 'TELEGRAM'
}, {
name: 'Discord',
answer: 'DISCORD'
}, {
name: 'Zoom',
answer: 'ZOOM'
}, {
name: 'Skype',
answer: 'SKYPE'
}, {
name: 'PayPal',
answer: 'PAYPAL'
}, {
name: 'Amazon',
answer: 'AMAZON'
}, {
name: 'eBay',
answer: 'EBAY'
}, {
name: 'Uber',
answer: 'UBER'
}, {
name: 'Airbnb',
answer: 'AIRBNB'
}],
'Football': [{
name: 'Barcelona',
answer: 'BARCELONA'
}, {
name: 'Real Madrid',
answer: 'REALMADRID'
}, {
name: 'Liverpool',
answer: 'LIVERPOOL'
}, {
name: 'Manchester United',
answer: 'MANCHESTER'
}, {
name: 'Arsenal',
answer: 'ARSENAL'
}, {
name: 'Bayern München',
answer: 'BAYERNMUNCHEN'
}, {
name: 'Galatasaray',
answer: 'GALATASARAY'
}, {
name: 'Chelsea',
answer: 'CHELSEA'
}, {
name: 'Manchester City',
answer: 'MANCHESTERCITY'
}, {
name: 'Inter Milan',
answer: 'INTERMILAN'
}, {
name: 'Juventus',
answer: 'JUVENTUS'
}, {
name: 'PSG',
answer: 'PSG'
}, {
name: 'AC Milan',
answer: 'ACMILAN'
}],
'Cars': [{
name: 'BMW',
answer: 'BMW'
}, {
name: 'Mercedes',
answer: 'MERCEDES'
}, {
name: 'Toyota',
answer: 'TOYOTA'
}, {
name: 'Ferrari',
answer: 'FERRARI'
}, {
name: 'Audi',
answer: 'AUDI'
}, {
name: 'Tesla',
answer: 'TESLA'
}, {
name: 'Lamborghini',
answer: 'LAMBORGHINI'
}, {
name: 'Tog',
answer: 'TOGG'
}, {
name: 'Porsche',
answer: 'PORSCHE'
}, {
name: 'Bugatti',
answer: 'BUGATTI'
}, {
name: 'Nissan',
answer: 'NISSAN'
}, {
name: 'Honda',
answer: 'HONDA'
}, {
name: 'Volkswagen',
answer: 'VOLKSWAGEN'
}],
'Food': [{
name: 'McDonalds',
answer: 'MCDONALDS'
}, {
name: 'KFC',
answer: 'KFC'
}, {
name: 'Subway',
answer: 'SUBWAY'
}, {
name: 'Pizza Hut',
answer: 'PIZZAHUT'
}, {
name: 'Starbucks',
answer: 'STARBUCKS'
}, {
name: 'Dominos',
answer: 'DOMINOS'
}, {
name: 'Burger King',
answer: 'BURGERKING'
}, {
name: 'Coca Cola',
answer: 'COCACOLA'
}, {
name: 'Pepsi',
answer: 'PEPSI'
}, {
name: 'Sprite',
answer: 'SPRITE'
}, {
name: 'Fanta',
answer: 'FANTA'
}, {
name: 'Heinz',
answer: 'HEINZ'
}, {
name: 'Nestle',
answer: 'NESTLE'
}, {
name: 'Oreo',
answer: 'OREO'
}],
'Footballers': [{
name: 'Messi',
answer: 'MESSI'
}, {
name: 'Ronaldo',
answer: 'RONALDO'
}, {
name: 'Neymar',
answer: 'NEYMAR'
}, {
name: 'Mbappe',
answer: 'MBAPPE'
}, {
name: 'Haaland',
answer: 'HAALAND'
}, {
name: 'Benzema',
answer: 'BENZEMA'
}, {
name: 'Lewandowski',
answer: 'LEWANDOWSKI'
}, {
name: 'Mesut Ozil',
answer: 'MESUTOEZIL'
}, {
name: 'Arda Guler',
answer: 'ARDAGULER'
}, {
name: 'Luka Modric',
answer: 'LUKAMODRIC'
}, {
name: 'Vinicius Junior',
answer: 'VINICIUSJUNIOR'
}, {
name: 'Lamin Yemal',
answer: 'LAMINYEMAL'
}, {
name: 'Gianluigi Donnarumma',
answer: 'DONNARUMMA'
}, {
name: 'Karim Benzema',
answer: 'KARIMBEN'
}, {
name: 'Robert Lewandowski',
answer: 'ROBERT'
}, {
name: 'Jan Oblak',
answer: 'OBLAK'
}, {
name: 'Sergio Ramos',
answer: 'RAMOS'
}, {
name: 'Gerard Pique',
answer: 'PIQUE'
}, {
name: 'Dani Alves',
answer: 'ALVES'
}],
'Flags': [{
name: 'Turkey',
answer: 'TURKEY',
answerTR: 'TURKIYE'
}, {
name: 'Germany',
answer: 'GERMANY',
answerTR: 'ALMANYA'
}, {
name: 'France',
answer: 'FRANCE',
answerTR: 'FRANSA'
}, {
name: 'Spain',
answer: 'SPAIN',
answerTR: 'ISPANYA'
}, {
name: 'Italy',
answer: 'ITALY',
answerTR: 'ITALYA'
}, {
name: 'Brazil',
answer: 'BRAZIL',
answerTR: 'BREZILYA'
}, {
name: 'Argentina',
answer: 'ARGENTINA',
answerTR: 'ARJANTIN'
}, {
name: 'England',
answer: 'ENGLAND',
answerTR: 'INGILTERE'
}, {
name: 'Portugal',
answer: 'PORTUGAL',
answerTR: 'PORTEKIZ'
}, {
name: 'Netherlands',
answer: 'NETHERLANDS',
answerTR: 'HOLLANDA'
}, {
name: 'Russia',
answer: 'RUSSIA',
answerTR: 'RUSYA'
}, {
name: 'Japan',
answer: 'JAPAN',
answerTR: 'JAPONYA'
}, {
name: 'South Korea',
answer: 'SOUTHKOREA',
answerTR: 'GUNEYKORE'
}, {
name: 'Mexico',
answer: 'MEXICO',
answerTR: 'MEKSIKA'
}, {
name: 'Canada',
answer: 'CANADA',
answerTR: 'KANADA'
}, {
name: 'Australia',
answer: 'AUSTRALIA',
answerTR: 'AVUSTRALYA'
}, {
name: 'Greece',
answer: 'GREECE',
answerTR: 'YUNANISTAN'
}, {
name: 'Belgium',
answer: 'BELGIUM',
answerTR: 'BELCIKA'
}, {
name: 'Croatia',
answer: 'CROATIA',
answerTR: 'HIRVATISTAN'
}, {
name: 'Poland',
answer: 'POLAND',
answerTR: 'POLONYA'
}, {
name: 'Sweden',
answer: 'SWEDEN',
answerTR: 'ISVEC'
}],
'Games': [{
name: 'Minecraft',
answer: 'MINECRAFT'
}, {
name: 'Fortnite',
answer: 'FORTNITE'
}, {
name: 'PUBG',
answer: 'PUBG'
}, {
name: 'Among Us',
answer: 'AMONGUS'
}, {
name: 'Clash of Clans',
answer: 'CLASHOFCLANS'
}, {
name: 'Clash Royale',
answer: 'CLASHROYALE'
}, {
name: 'Candy Crush',
answer: 'CANDYCRUSH'
}, {
name: 'Pokemon Go',
answer: 'POKEMONGO'
}, {
name: 'Subway Surfers',
answer: 'SUBWAYSURFERS'
}, {
name: 'Temple Run',
answer: 'TEMPLERUN'
}, {
name: 'Angry Birds',
answer: 'ANGRYBIRDS'
}, {
name: 'Roblox',
answer: 'ROBLOX'
}, {
name: 'Counter Strike',
answer: 'COUNTERSTRIKE'
}, {
name: 'League of Legends',
answer: 'LEAGUEOFLEGENDS'
}, {
name: 'Dota 2',
answer: 'DOTA2'
}, {
name: 'World of Warcraft',
answer: 'WORLDOFWARCRAFT'
}, {
name: 'Valorant',
answer: 'VALORANT'
}, {
name: 'Apex Legends',
answer: 'APEXLEGENDS'
}, {
name: 'Call of Duty',
answer: 'CALLOFDUTY'
}, {
name: 'Grand Theft Auto',
answer: 'GRANDTHEFTAUTO'
}, {
name: 'Overwatch',
answer: 'OVERWATCH'
}, {
name: 'Steam',
answer: 'STEAM'
}]
};
// UI Elements
var coinDisplay;
var backButton;
function isCategoryUnlocked(category) {
// Technology is always unlocked
if (category === 'Technology') return true;
// Football unlocks after 2 Technology completions
if (category === 'Football') return categoryCompletions['Technology'] >= 2;
// Cars unlocks after 2 Football completions
if (category === 'Cars') return categoryCompletions['Football'] >= 2;
// Food unlocks after 2 Cars completions
if (category === 'Food') return categoryCompletions['Cars'] >= 2;
// Footballers unlocks after 2 Food completions
if (category === 'Footballers') return categoryCompletions['Food'] >= 2;
// Flags unlocks after 2 Footballers completions
if (category === 'Flags') return categoryCompletions['Footballers'] >= 2;
// Games unlocks after 2 Flags completions
if (category === 'Games') return categoryCompletions['Flags'] >= 2;
return false;
}
function showLockedCategoryMessage(category) {
// Calculate requirements
var requiredCategory = '';
var requiredCount = 2;
var currentCompleted = 0;
var remaining = 0;
if (category === 'Football') {
requiredCategory = 'Technology';
currentCompleted = categoryCompletions['Technology'];
} else if (category === 'Cars') {
requiredCategory = 'Football';
currentCompleted = categoryCompletions['Football'];
} else if (category === 'Food') {
requiredCategory = 'Cars';
currentCompleted = categoryCompletions['Cars'];
} else if (category === 'Footballers') {
requiredCategory = 'Food';
currentCompleted = categoryCompletions['Food'];
} else if (category === 'Flags') {
requiredCategory = 'Footballers';
currentCompleted = categoryCompletions['Footballers'];
} else if (category === 'Games') {
requiredCategory = 'Flags';
currentCompleted = categoryCompletions['Flags'];
}
remaining = Math.max(0, requiredCount - currentCompleted);
// Create overlay message
var messageOverlay = new Container();
messageOverlay.x = 1024;
messageOverlay.y = 1366;
// Semi-transparent background
var bgShape = LK.getAsset('categoryButton', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 2.0
});
bgShape.tint = 0x000000;
bgShape.alpha = 0.8;
messageOverlay.addChild(bgShape);
// Main message text
var messageText = new Text2('Kilitli Kategori!', {
size: 80,
fill: 0xFF0000
});
messageText.anchor.set(0.5, 0.5);
messageText.y = -80;
messageOverlay.addChild(messageText);
// Requirement text showing remaining count
var requirementText = new Text2(remaining + ' tane daha ' + requiredCategory + ' çözmen gerekiyor', {
size: 60,
fill: 0xFFFFFF
});
requirementText.anchor.set(0.5, 0.5);
requirementText.y = 0;
messageOverlay.addChild(requirementText);
// Progress text showing current progress
var progressText = new Text2('Şu anda: ' + currentCompleted + '/' + requiredCount, {
size: 50,
fill: 0xFFD700
});
progressText.anchor.set(0.5, 0.5);
progressText.y = 60;
messageOverlay.addChild(progressText);
// Add to game
game.addChild(messageOverlay);
// Auto-remove after 3 seconds
LK.setTimeout(function () {
if (messageOverlay.parent) {
messageOverlay.parent.removeChild(messageOverlay);
messageOverlay.destroy();
}
}, 3000);
}
function initializeMenu() {
game.removeChildren();
gameState = 'menu';
// Reset pagination for all categories
TechnologyPage = 0;
FootballPage = 0;
CarsPage = 0;
FoodPage = 0;
FootballersPage = 0;
FlagsPage = 0;
GamesPage = 0;
// Title
var title = new Text2(languageTexts[currentLanguage].title, {
size: 120,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 500;
game.addChild(title);
// Calculate and display total completions
var totalCompleted = Object.keys(completedLogos).length;
var totalLogos = 0;
for (var category in logoDatabase) {
totalLogos += logoDatabase[category].length;
}
var progressText = new Text2(languageTexts[currentLanguage].completed + totalCompleted + '/' + totalLogos, {
size: 80,
fill: 0xFFD700
});
progressText.anchor.set(0.5, 0.5);
progressText.x = 1024;
progressText.y = 600;
game.addChild(progressText);
// Play button
var playButton = new CategoryButton('Oynamaya Başla');
playButton.x = 1024;
playButton.y = 750;
playButton.down = function (x, y, obj) {
playButton.scaleX = 0.95;
playButton.scaleY = 0.95;
showCategorySelection();
};
playButton.up = function (x, y, obj) {
playButton.scaleX = 1;
playButton.scaleY = 1;
};
game.addChild(playButton);
// Category buttons
var categories = ['Technology', 'Football', 'Cars', 'Food', 'Footballers', 'Flags', 'Games'];
for (var i = 0; i < categories.length; i++) {
var isUnlocked = isCategoryUnlocked(categories[i]);
var button = new CategoryButton(categories[i]);
button.x = 1024;
button.y = 800 + i * 220;
// Visual feedback for locked categories
if (!isUnlocked) {
button.alpha = 0.5;
// Override the down handler to show requirement message for locked categories
button.down = function (x, y, obj) {
showLockedCategoryMessage(categories[i]);
};
// Add lock symbol
var lockText = new Text2('🔒', {
size: 60,
fill: 0xFFFFFF
});
lockText.anchor.set(0.5, 0.5);
lockText.x = 300; // Position to the right of category name
lockText.y = 0;
button.addChild(lockText);
// Show completion requirement
var reqText = '';
if (categories[i] === 'Football') reqText = '(' + categoryCompletions['Technology'] + '/2 Technology)';else if (categories[i] === 'Cars') reqText = '(' + categoryCompletions['Football'] + '/2 Football)';else if (categories[i] === 'Food') reqText = '(' + categoryCompletions['Cars'] + '/2 Cars)';else if (categories[i] === 'Footballers') reqText = '(' + categoryCompletions['Food'] + '/2 Food)';else if (categories[i] === 'Flags') reqText = '(' + categoryCompletions['Footballers'] + '/2 Footballers)';else if (categories[i] === 'Games') reqText = '(' + categoryCompletions['Flags'] + '/2 Flags)';
if (reqText) {
var requirementText = new Text2(reqText, {
size: 40,
fill: 0xFFFFFF
});
requirementText.anchor.set(0.5, 0.5);
requirementText.x = 0;
requirementText.y = 60;
button.addChild(requirementText);
}
}
game.addChild(button);
}
updateCoinDisplay();
}
function showCategorySelection() {
// Batch clear operations for better performance
while (game.children.length > 0) {
var child = game.children[0];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
gameState = 'categorySelect';
// Title
var title = new Text2('Kategori Seç', {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
game.addChild(title);
// Category buttons
var categories = ['Technology', 'Football', 'Cars', 'Food', 'Footballers', 'Flags', 'Games'];
for (var i = 0; i < categories.length; i++) {
var isUnlocked = isCategoryUnlocked(categories[i]);
var button = new CategoryButton(categories[i]);
button.x = 1024;
button.y = 700 + i * 200;
// Visual feedback for locked categories
if (!isUnlocked) {
button.alpha = 0.5;
// Override the down handler to show requirement message for locked categories
button.down = function (x, y, obj) {
showLockedCategoryMessage(categories[i]);
};
// Add lock symbol
var lockText = new Text2('🔒', {
size: 60,
fill: 0xFFFFFF
});
lockText.anchor.set(0.5, 0.5);
lockText.x = 300;
lockText.y = 0;
button.addChild(lockText);
// Show completion requirement
var reqText = '';
if (categories[i] === 'Football') reqText = '(' + categoryCompletions['Technology'] + '/2 Technology)';else if (categories[i] === 'Cars') reqText = '(' + categoryCompletions['Football'] + '/2 Football)';else if (categories[i] === 'Food') reqText = '(' + categoryCompletions['Cars'] + '/2 Cars)';else if (categories[i] === 'Footballers') reqText = '(' + categoryCompletions['Food'] + '/2 Food)';else if (categories[i] === 'Flags') reqText = '(' + categoryCompletions['Footballers'] + '/2 Footballers)';else if (categories[i] === 'Games') reqText = '(' + categoryCompletions['Flags'] + '/2 Flags)';
if (reqText) {
var requirementText = new Text2(reqText, {
size: 40,
fill: 0xFFFFFF
});
requirementText.anchor.set(0.5, 0.5);
requirementText.x = 0;
requirementText.y = 60;
button.addChild(requirementText);
}
}
game.addChild(button);
}
// Back button to return to main menu
var backBtn = new ExitButton();
backBtn.x = 1848;
backBtn.y = 350;
backBtn.down = function (x, y, obj) {
backBtn.scaleX = 0.95;
backBtn.scaleY = 0.95;
initializeMenu();
};
backBtn.up = function (x, y, obj) {
backBtn.scaleX = 1;
backBtn.scaleY = 1;
};
game.addChild(backBtn);
updateCoinDisplay();
}
function showCategoryLogos(category) {
// Batch clear operations for better performance
while (game.children.length > 0) {
var child = game.children[0];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
gameState = 'category';
currentCategory = category;
// Category title
var title = new Text2(category + ' Logos', {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
game.addChild(title);
// Show category completion stats
var categoryCompleted = categoryCompletions[category] || 0;
var categoryTotal = logoDatabase[category].length;
var statsText = new Text2('Tamamlanan: ' + categoryCompleted + '/' + categoryTotal, {
size: 60,
fill: 0xFFD700
});
statsText.anchor.set(0.5, 0.5);
statsText.x = 1024;
statsText.y = 480;
game.addChild(statsText);
// Logo buttons - filter out completed logos
var logos = logoDatabase[category];
var availableLogos = [];
for (var i = 0; i < logos.length; i++) {
var logoKey = category + '_' + logos[i].name;
if (!completedLogos[logoKey]) {
availableLogos.push(logos[i]);
}
}
var cols = 3;
var startX = 1024 - (cols - 1) * 250;
var startY = 700;
// Handle pagination for all categories
var allLogos = logoDatabase[category];
var logosToShow = allLogos;
var showPagination = false;
// Check if category needs pagination (more than 12 logos)
if (allLogos.length > 12) {
showPagination = true;
var currentPage = 0;
// Get current page for this category
if (category === 'Technology') currentPage = TechnologyPage;else if (category === 'Football') currentPage = FootballPage;else if (category === 'Cars') currentPage = CarsPage;else if (category === 'Food') currentPage = FoodPage;else if (category === 'Footballers') currentPage = FootballersPage;else if (category === 'Flags') currentPage = FlagsPage;else if (category === 'Games') currentPage = GamesPage;
var logosPerPage = 12;
var startIndex = currentPage * logosPerPage;
var endIndex = Math.min(startIndex + logosPerPage, allLogos.length);
logosToShow = allLogos.slice(startIndex, endIndex);
}
// Show logos with completion status
for (var i = 0; i < logosToShow.length; i++) {
var logoButton = new LogoButton(logosToShow[i].name + 'Logo', logosToShow[i]);
logoButton.x = startX + i % cols * 500;
logoButton.y = startY + Math.floor(i / cols) * 450;
game.addChild(logoButton);
// Check if this logo is completed and add checkmark
var logoKey = category + '_' + logosToShow[i].name;
if (completedLogos[logoKey]) {
var checkmark = logoButton.attachAsset('checkmark', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.8,
scaleY: 0.8
});
checkmark.x = 150; // Position in top-right corner of logo button
checkmark.y = -150;
}
}
// Add pagination buttons for all categories with more than 12 logos - positioned at bottom
if (showPagination) {
var currentPageKey = category + 'Page';
var currentPage = 0;
// Get current page for this category
if (category === 'Technology') currentPage = TechnologyPage;else if (category === 'Football') currentPage = FootballPage;else if (category === 'Cars') currentPage = CarsPage;else if (category === 'Food') currentPage = FoodPage;else if (category === 'Footballers') currentPage = FootballersPage;else if (category === 'Flags') currentPage = FlagsPage;else if (category === 'Games') currentPage = GamesPage;
var totalPages = Math.ceil(allLogos.length / logosPerPage);
var paginationY = 2400; // Move even lower for better spacing
// Previous page button
if (currentPage > 0) {
var prevButton = new CategoryButton('◄ Önceki');
prevButton.x = 400;
prevButton.y = paginationY;
prevButton.scaleX = 0.9;
prevButton.scaleY = 0.9;
prevButton.down = function (x, y, obj) {
prevButton.scaleX = 0.85;
prevButton.scaleY = 0.85;
// Update the correct category page variable
if (category === 'Technology') TechnologyPage--;else if (category === 'Football') FootballPage--;else if (category === 'Cars') CarsPage--;else if (category === 'Food') FoodPage--;else if (category === 'Footballers') FootballersPage--;else if (category === 'Flags') FlagsPage--;else if (category === 'Games') GamesPage--;
showCategoryLogos(category);
};
prevButton.up = function (x, y, obj) {
prevButton.scaleX = 0.9;
prevButton.scaleY = 0.9;
};
game.addChild(prevButton);
}
// Page indicator
var pageText = new Text2('Sayfa ' + (currentPage + 1) + '/' + totalPages, {
size: 70,
fill: 0xFFFFFF
});
pageText.anchor.set(0.5, 0.5);
pageText.x = 1024;
pageText.y = paginationY;
game.addChild(pageText);
// Next page button
if (currentPage < totalPages - 1) {
var nextButton = new CategoryButton('Sonraki ►');
nextButton.x = 1548; // Move button more to the left
nextButton.y = paginationY;
nextButton.scaleX = 0.8; // Make button smaller
nextButton.scaleY = 0.8; // Make button smaller
nextButton.down = function (x, y, obj) {
nextButton.scaleX = 0.75;
nextButton.scaleY = 0.75;
// Update the correct category page variable
if (category === 'Technology') TechnologyPage++;else if (category === 'Football') FootballPage++;else if (category === 'Cars') CarsPage++;else if (category === 'Food') FoodPage++;else if (category === 'Footballers') FootballersPage++;else if (category === 'Flags') FlagsPage++;else if (category === 'Games') GamesPage++;
showCategoryLogos(category);
};
nextButton.up = function (x, y, obj) {
nextButton.scaleX = 0.8;
nextButton.scaleY = 0.8;
};
game.addChild(nextButton);
}
}
// Exit button
var exitBtn = new ExitButton();
exitBtn.x = 1848; // Position in top right area, below coins
exitBtn.y = 350; // Further below the coin display
exitBtn.down = function (x, y, obj) {
exitBtn.scaleX = 0.95;
exitBtn.scaleY = 0.95;
initializeMenu(); // Return to main menu instead of category
};
exitBtn.up = function (x, y, obj) {
exitBtn.scaleX = 1;
exitBtn.scaleY = 1;
};
game.addChild(exitBtn);
updateCoinDisplay();
}
function startLogoGuess(logoData) {
// Efficient cleanup
while (game.children.length > 0) {
var child = game.children[0];
game.removeChild(child);
if (child.destroy) {
child.destroy();
}
}
gameState = 'guessing';
currentLogo = logoData;
currentLogoUsedHint = false;
// Clear arrays efficiently
letterTiles.length = 0;
answerSlots.length = 0;
// Logo display area - larger and more prominent visual logo
var logoAssetName = logoData.name.toLowerCase() + 'Logo';
if (logoData.name === 'Real Madrid') {
logoAssetName = 'realmadridLogo';
}
if (logoData.name === 'Manchester United') {
logoAssetName = 'manchesterLogo';
}
if (logoData.name === 'McDonalds') {
logoAssetName = 'mcdonaldsLogo';
}
if (logoData.name === 'Pizza Hut') {
logoAssetName = 'pizzahutLogo';
}
if (logoData.name === 'Instagram') {
logoAssetName = 'instagramLogo';
}
if (logoData.name === 'TikTok') {
logoAssetName = 'tiktokLogo';
}
if (logoData.name === 'Burger King') {
logoAssetName = 'burgerkingLogo';
}
if (logoData.name === 'Bayern München') {
logoAssetName = 'bayernmunchenLogo';
}
if (logoData.name === 'Galatasaray') {
logoAssetName = 'galatasarayLogo';
}
if (logoData.name === 'Tesla') {
logoAssetName = 'teslaLogo';
}
if (logoData.name === 'Lamborghini') {
logoAssetName = 'lamborghiniLogo';
}
if (logoData.name === 'Tog') {
logoAssetName = 'togLogo';
}
if (logoData.name === 'ChatGPT') {
logoAssetName = 'chatgptLogo';
}
if (logoData.name === 'Xiaomi') {
logoAssetName = 'xiaomiLogo';
}
if (logoData.name === 'Twitter') {
logoAssetName = 'xLogo';
}
if (logoData.name === 'YouTube') {
logoAssetName = 'youtubeLogo';
}
if (logoData.name === 'Netflix') {
logoAssetName = 'netflixLogo';
}
if (logoData.name === 'Spotify') {
logoAssetName = 'spotifyLogo';
}
if (logoData.name === 'WhatsApp') {
logoAssetName = 'whatsappLogo';
}
if (logoData.name === 'Telegram') {
logoAssetName = 'telegramLogo';
}
if (logoData.name === 'Discord') {
logoAssetName = 'discordLogo';
}
if (logoData.name === 'Zoom') {
logoAssetName = 'zoomLogo';
}
if (logoData.name === 'Skype') {
logoAssetName = 'skypeLogo';
}
if (logoData.name === 'PayPal') {
logoAssetName = 'paypalLogo';
}
if (logoData.name === 'Amazon') {
logoAssetName = 'amazonLogo';
}
if (logoData.name === 'eBay') {
logoAssetName = 'ebayLogo';
}
if (logoData.name === 'Uber') {
logoAssetName = 'uberLogo';
}
if (logoData.name === 'Airbnb') {
logoAssetName = 'airbnbLogo';
}
// Footballers category assets
if (logoData.name === 'Messi') {
logoAssetName = 'messiLogo';
}
if (logoData.name === 'Ronaldo') {
logoAssetName = 'ronaldoLogo';
}
if (logoData.name === 'Neymar') {
logoAssetName = 'neymarLogo';
}
if (logoData.name === 'Mbappe') {
logoAssetName = 'mbappeLogo';
}
if (logoData.name === 'Haaland') {
logoAssetName = 'haalandLogo';
}
if (logoData.name === 'Benzema') {
logoAssetName = 'benzemaLogo';
}
if (logoData.name === 'Lewandowski') {
logoAssetName = 'lewandowskiLogo';
}
if (logoData.name === 'Mesut Ozil') {
logoAssetName = 'mesutoezilLogo';
}
if (logoData.name === 'Arda Guler') {
logoAssetName = 'ardagulerLogo';
}
if (logoData.name === 'Luka Modric') {
logoAssetName = 'lukamodricLogo';
}
if (logoData.name === 'Vinicius Junior') {
logoAssetName = 'viniciusjuniorLogo';
}
if (logoData.name === 'Erling Haaland') {
logoAssetName = 'erlinghaalandLogo';
}
if (logoData.name === 'Lamin Yemal') {
logoAssetName = 'laminyemalLogo';
}
// Flags category assets
if (logoData.name === 'Turkey') {
logoAssetName = 'turkeyLogo';
}
if (logoData.name === 'Germany') {
logoAssetName = 'germanyLogo';
}
if (logoData.name === 'France') {
logoAssetName = 'franceLogo';
}
if (logoData.name === 'Spain') {
logoAssetName = 'spainLogo';
}
if (logoData.name === 'Italy') {
logoAssetName = 'italyLogo';
}
if (logoData.name === 'Brazil') {
logoAssetName = 'brazilLogo';
}
if (logoData.name === 'Argentina') {
logoAssetName = 'argentinaLogo';
}
if (logoData.name === 'England') {
logoAssetName = 'englandLogo';
}
if (logoData.name === 'Portugal') {
logoAssetName = 'portugalLogo';
}
if (logoData.name === 'Netherlands') {
logoAssetName = 'netherlandsLogo';
}
if (logoData.name === 'Russia') {
logoAssetName = 'russiaLogo';
}
if (logoData.name === 'Japan') {
logoAssetName = 'japanLogo';
}
if (logoData.name === 'South Korea') {
logoAssetName = 'southkoreaLogo';
}
if (logoData.name === 'Mexico') {
logoAssetName = 'mexicoLogo';
}
if (logoData.name === 'Canada') {
logoAssetName = 'canadaLogo';
}
if (logoData.name === 'Australia') {
logoAssetName = 'australiaLogo';
}
if (logoData.name === 'Greece') {
logoAssetName = 'greeceLogo';
}
if (logoData.name === 'Belgium') {
logoAssetName = 'belgiumLogo';
}
if (logoData.name === 'Croatia') {
logoAssetName = 'croatiaLogo';
}
if (logoData.name === 'Poland') {
logoAssetName = 'polandLogo';
}
if (logoData.name === 'Sweden') {
logoAssetName = 'swedenLogo';
}
// Games category assets
if (logoData.name === 'Minecraft') {
logoAssetName = 'minecraftLogo';
}
if (logoData.name === 'Fortnite') {
logoAssetName = 'fortniteLogo';
}
if (logoData.name === 'PUBG') {
logoAssetName = 'pubgLogo';
}
if (logoData.name === 'Among Us') {
logoAssetName = 'amongusLogo';
}
if (logoData.name === 'Clash of Clans') {
logoAssetName = 'clashofclansLogo';
}
if (logoData.name === 'Clash Royale') {
logoAssetName = 'clashroyaleLogo';
}
if (logoData.name === 'Candy Crush') {
logoAssetName = 'candycrushLogo';
}
if (logoData.name === 'Pokemon Go') {
logoAssetName = 'pokemongoLogo';
}
if (logoData.name === 'Subway Surfers') {
logoAssetName = 'subwaysurfersLogo';
}
if (logoData.name === 'Temple Run') {
logoAssetName = 'templerunLogo';
}
if (logoData.name === 'Angry Birds') {
logoAssetName = 'angrybirdsLogo';
}
if (logoData.name === 'Roblox') {
logoAssetName = 'robloxLogo';
}
if (logoData.name === 'Counter Strike') {
logoAssetName = 'counterstrikeLogo';
}
if (logoData.name === 'League of Legends') {
logoAssetName = 'leagueoflegendsLogo';
}
if (logoData.name === 'Dota 2') {
logoAssetName = 'dota2Logo';
}
if (logoData.name === 'World of Warcraft') {
logoAssetName = 'worldofwarcraftLogo';
}
if (logoData.name === 'Valorant') {
logoAssetName = 'valorantLogo';
}
if (logoData.name === 'Apex Legends') {
logoAssetName = 'apexlegendsLogo';
}
if (logoData.name === 'Call of Duty') {
logoAssetName = 'callofdutyLogo';
}
if (logoData.name === 'Grand Theft Auto') {
logoAssetName = 'grandtheftautoLogo';
}
if (logoData.name === 'Overwatch') {
logoAssetName = 'overwatchLogo';
}
if (logoData.name === 'Steam') {
logoAssetName = 'steamLogo';
}
var logoVisual = LK.getAsset(logoAssetName, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
logoVisual.x = 1024;
logoVisual.y = 500;
game.addChild(logoVisual);
// Get the appropriate answer based on language and category
var currentAnswer = logoData.answer;
if (currentCategory === 'Flags' && currentLanguage === 'tr' && logoData.answerTR) {
currentAnswer = logoData.answerTR;
}
// Create answer slots with word separation
var answerLength = currentAnswer.length;
var slotSpacing = 140;
var wordGap = 60; // Extra space between words
// Determine word boundaries for multi-word answers
var wordBoundaries = [];
var displayName = currentLogo.name;
// Check for two-word combinations
if (displayName === 'Real Madrid' || displayName === 'Manchester United' || displayName === 'Pizza Hut' || displayName === 'Burger King' || displayName === 'Bayern München' || displayName === 'Mesut Ozil' || displayName === 'Arda Guler' || displayName === 'Luka Modric' || displayName === 'Vinicius Junior' || displayName === 'Lamin Yemal' || displayName === 'Clash of Clans' || displayName === 'Clash Royale' || displayName === 'Candy Crush' || displayName === 'Pokemon Go' || displayName === 'Subway Surfers' || displayName === 'Temple Run' || displayName === 'Angry Birds' || displayName === 'Counter Strike' || displayName === 'League of Legends' || displayName === 'Dota 2' || displayName === 'World of Warcraft' || displayName === 'Apex Legends' || displayName === 'Call of Duty' || displayName === 'Grand Theft Auto' || displayName === 'Among Us') {
// Find the word break position in the answer
var firstWordLength = 0;
if (displayName === 'Real Madrid') firstWordLength = 4; // REAL
else if (displayName === 'Manchester United') firstWordLength = 10; // MANCHESTER
else if (displayName === 'Pizza Hut') firstWordLength = 5; // PIZZA
else if (displayName === 'Burger King') firstWordLength = 6; // BURGER
else if (displayName === 'Bayern München') firstWordLength = 6; // BAYERN
else if (displayName === 'Mesut Ozil') firstWordLength = 5; // MESUT
else if (displayName === 'Arda Guler') firstWordLength = 4; // ARDA
else if (displayName === 'Luka Modric') firstWordLength = 4; // LUKA
else if (displayName === 'Vinicius Junior') firstWordLength = 8; // VINICIUS
else if (displayName === 'Lamin Yemal') firstWordLength = 5; // LAMIN
else if (displayName === 'Clash of Clans') firstWordLength = 5; // CLASH (first word before "OF")
else if (displayName === 'Clash Royale') firstWordLength = 5; // CLASH
else if (displayName === 'Candy Crush') firstWordLength = 5; // CANDY
else if (displayName === 'Pokemon Go') firstWordLength = 7; // POKEMON
else if (displayName === 'Subway Surfers') firstWordLength = 6; // SUBWAY
else if (displayName === 'Temple Run') firstWordLength = 6; // TEMPLE
else if (displayName === 'Angry Birds') firstWordLength = 5; // ANGRY
else if (displayName === 'Counter Strike') firstWordLength = 7; // COUNTER
else if (displayName === 'League of Legends') firstWordLength = 6; // LEAGUE (first word before "OF")
else if (displayName === 'Dota 2') firstWordLength = 4; // DOTA
else if (displayName === 'World of Warcraft') firstWordLength = 5; // WORLD (first word before "OF")
else if (displayName === 'Apex Legends') firstWordLength = 4; // APEX
else if (displayName === 'Call of Duty') firstWordLength = 4; // CALL (first word before "OF")
else if (displayName === 'Grand Theft Auto') firstWordLength = 5; // GRAND (first word before "THEFT")
else if (displayName === 'Among Us') firstWordLength = 5; // AMONG
wordBoundaries.push(firstWordLength);
}
// Calculate total width including word gaps
var totalSlots = answerLength;
var totalGaps = wordBoundaries.length * wordGap;
var totalWidth = (totalSlots - 1) * slotSpacing + totalGaps;
var startX = 1024 - totalWidth / 2;
// Create slots with word separation
var currentX = startX;
for (var i = 0; i < answerLength; i++) {
var slot = new AnswerSlot(i);
slot.x = currentX;
slot.y = 900;
answerSlots.push(slot);
game.addChild(slot);
// Add extra space after word boundaries
currentX += slotSpacing;
for (var w = 0; w < wordBoundaries.length; w++) {
if (i === wordBoundaries[w] - 1) {
currentX += wordGap;
break;
}
}
}
// Create letter tiles
createLetterTiles(currentAnswer);
// Restore any existing hint letters from storage
var logoKey = currentCategory + '_' + currentLogo.name;
for (var i = 0; i < answerSlots.length; i++) {
var hintKey = logoKey + '_hint_' + i;
var hintLetter = storage[hintKey];
if (hintLetter) {
// Find the corresponding letter tile
for (var j = 0; j < letterTiles.length; j++) {
var tile = letterTiles[j];
if (tile.letter === hintLetter && !tile.isPlaced) {
placeLetter(tile, answerSlots[i]);
// Mark as hint letter with green color
answerSlots[i].letterCopy.isHintLetter = true;
answerSlots[i].letterCopy.letterText.fill = 0x00FF00;
answerSlots[i].letterCopy.letterText.tint = 0x00FF00;
// Create green background for hint letter
var hintBackground = LK.getAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
hintBackground.tint = 0x00FF00; // Green background
hintBackground.x = answerSlots[i].x;
hintBackground.y = answerSlots[i].y;
answerSlots[i].hintBackground = hintBackground;
game.addChild(hintBackground);
// Move letter copy to front
game.removeChild(answerSlots[i].letterCopy);
game.addChild(answerSlots[i].letterCopy);
break;
}
}
}
}
// Hint button
var hintBtn = new HintButton();
hintBtn.x = 1024;
hintBtn.y = 1200;
game.addChild(hintBtn);
// Exit button
var exitBtn = new ExitButton();
exitBtn.x = 1848; // Position in top right area, below coins
exitBtn.y = 350; // Further below the coin display
game.addChild(exitBtn);
updateCoinDisplay();
}
// Pre-allocated letter pool for reuse
var letterPool = [];
var poolIndex = 0;
function createLetterTiles(answer) {
// Clear existing tiles efficiently
for (var i = 0; i < letterTiles.length; i++) {
letterTiles[i].destroy();
}
letterTiles.length = 0;
poolIndex = 0;
var letters = answer.split('');
var decoyLetters = ['X', 'Z', 'Q', 'J', 'K', 'W', 'V', 'Y', 'H', 'P', 'C', 'U', 'N', 'D', 'F', 'B', 'G', 'M', 'R', 'S'];
var allLetters = letters.slice(); // Copy answer letters
// Add decoy letters to reach exactly 12 total letters
var decoyCount = 12 - letters.length;
if (decoyCount > 0) {
// Add decoy letters, cycling through the expanded decoy array if needed
for (var d = 0; d < decoyCount; d++) {
allLetters.push(decoyLetters[d % decoyLetters.length]);
}
}
// If answer is longer than 12, just use the first 12 letters
if (allLetters.length > 12) {
allLetters = allLetters.slice(0, 12);
}
// Shuffle letters using optimized Fisher-Yates
for (var i = allLetters.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
if (i !== j) {
var temp = allLetters[i];
allLetters[i] = allLetters[j];
allLetters[j] = temp;
}
}
// Create tiles with object pooling
var cols = 5;
var startX = 1024 - (cols - 1) * 80;
var startY = 1450;
for (var i = 0; i < allLetters.length; i++) {
var tile = new LetterTile(allLetters[i]);
var posX = startX + i % cols * 160;
var posY = startY + Math.floor(i / cols) * 160;
tile.x = posX;
tile.y = posY;
// Store original position for reset functionality
tile.originalX = posX;
tile.originalY = posY;
// Ensure tile is visible
tile.alpha = 1;
tile.visible = true;
letterTiles.push(tile);
game.addChild(tile);
}
}
function createBackButton() {
// Back button functionality removed
}
function updateCoinDisplay() {
if (coinDisplay) {
coinDisplay.parent.removeChild(coinDisplay);
}
coinDisplay = new Container();
var coinIcon = coinDisplay.addChild(LK.getAsset('coinIcon', {
anchorX: 0.5,
anchorY: 0.5
}));
var coinText = new Text2(goldCoins.toString(), {
size: 60,
fill: 0xFFD700
});
coinText.anchor.set(1, 0.5);
coinText.x = -50;
coinDisplay.addChild(coinText);
coinDisplay.x = -80;
coinDisplay.y = 150;
LK.gui.topRight.addChild(coinDisplay);
}
function useHint() {
if (goldCoins < 3 || !currentLogo) {
return;
}
goldCoins -= 3;
storage.goldCoins = goldCoins;
currentLogoUsedHint = true;
updateCoinDisplay();
// Get the appropriate answer based on language and category
var hintAnswer = currentLogo.answer;
if (currentCategory === 'Flags' && currentLanguage === 'tr' && currentLogo.answerTR) {
hintAnswer = currentLogo.answerTR;
}
// Find all empty slots first
var emptySlots = [];
for (var i = 0; i < answerSlots.length; i++) {
var slot = answerSlots[i];
if (!slot.occupiedLetter) {
emptySlots.push({
slot: slot,
index: i
});
}
}
// If no empty slots, return
if (emptySlots.length === 0) {
return;
}
// Pick the first empty slot
var targetSlotInfo = emptySlots[0];
var correctLetter = hintAnswer[targetSlotInfo.index];
// Find the letter tile
for (var j = 0; j < letterTiles.length; j++) {
var tile = letterTiles[j];
if (tile.letter === correctLetter && !tile.isPlaced) {
placeLetter(tile, targetSlotInfo.slot);
// Mark this as a hint letter - permanent and different color
targetSlotInfo.slot.letterCopy.isHintLetter = true;
targetSlotInfo.slot.letterCopy.letterText.fill = 0x00FF00; // Green color for hint letters
targetSlotInfo.slot.letterCopy.letterText.tint = 0x00FF00; // Apply green tint as well
// Create green background for hint letter
var hintBackground = LK.getAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
hintBackground.tint = 0x00FF00; // Green background
hintBackground.x = targetSlotInfo.slot.x;
hintBackground.y = targetSlotInfo.slot.y;
targetSlotInfo.slot.hintBackground = hintBackground;
game.addChild(hintBackground);
// Move letter copy to front
game.removeChild(targetSlotInfo.slot.letterCopy);
game.addChild(targetSlotInfo.slot.letterCopy);
// Store hint letter data persistently
var logoKey = currentCategory + '_' + currentLogo.name;
var hintKey = logoKey + '_hint_' + targetSlotInfo.index;
storage[hintKey] = correctLetter;
break;
}
}
checkAnswer();
}
function removeLetter(letter) {
if (!letter.isPlaced || !letter.targetSlot) {
return;
}
var slot = letter.targetSlot;
// Check if this is a hint letter - if so, don't remove it
if (slot.letterCopy && slot.letterCopy.isHintLetter) {
return; // Cannot remove hint letters
}
// Clear slot
slot.occupiedLetter = null;
// Remove letter copy from answer slot
if (slot.letterCopy) {
if (slot.hintBackground) {
slot.hintBackground.destroy();
slot.hintBackground = null;
}
slot.letterCopy.destroy();
slot.letterCopy = null;
}
// Reset letter to original state
letter.isPlaced = false;
letter.targetSlot = null;
letter.alpha = 1;
letter.x = letter.originalX;
letter.y = letter.originalY;
}
function placeLetter(letter, slot) {
if (slot.occupiedLetter) {
// Check if the current letter in slot is a hint letter - if so, don't replace it
if (slot.letterCopy && slot.letterCopy.isHintLetter) {
return; // Cannot replace hint letters
}
// Return previous letter to pool
var prevLetter = slot.occupiedLetter;
prevLetter.isPlaced = false;
prevLetter.targetSlot = null;
prevLetter.alpha = 1;
// Remove the letter copy from answer slot
if (slot.letterCopy) {
if (slot.hintBackground) {
slot.hintBackground.destroy();
slot.hintBackground = null;
}
slot.letterCopy.destroy();
slot.letterCopy = null;
}
prevLetter.x = prevLetter.originalX;
prevLetter.y = prevLetter.originalY;
}
letter.isPlaced = true;
letter.targetSlot = slot;
slot.occupiedLetter = letter;
// Make the original tile appear faded/hidden
letter.alpha = 0.3;
// Create a copy of the letter in the answer slot
var letterCopy = new LetterTile(letter.letter);
letterCopy.x = slot.x;
letterCopy.y = slot.y;
letterCopy.isPlaced = true;
letterCopy.isHintLetter = false; // Initialize as not a hint letter
letterCopy.down = function (x, y, obj) {
// Only allow removal if not a hint letter
if (!letterCopy.isHintLetter) {
removeLetter(letter);
}
};
slot.letterCopy = letterCopy;
game.addChild(letterCopy);
}
function showSettings() {
game.removeChildren();
gameState = 'settings';
// Settings title
var title = new Text2(languageTexts[currentLanguage].settings, {
size: 120,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
game.addChild(title);
// Language section title
var langTitle = new Text2(languageTexts[currentLanguage].language, {
size: 80,
fill: 0xFFD700
});
langTitle.anchor.set(0.5, 0.5);
langTitle.x = 1024;
langTitle.y = 600;
game.addChild(langTitle);
// Turkish language button
var turkishButton = new CategoryButton(languageTexts[currentLanguage].turkish);
turkishButton.x = 700;
turkishButton.y = 750;
if (currentLanguage === 'tr') {
turkishButton.alpha = 1.0; // Fully visible when selected
} else {
turkishButton.alpha = 0.6; // Dimmed when not selected
}
turkishButton.down = function (x, y, obj) {
turkishButton.scaleX = 0.95;
turkishButton.scaleY = 0.95;
currentLanguage = 'tr';
storage.currentLanguage = currentLanguage;
showSettings(); // Refresh settings screen
};
turkishButton.up = function (x, y, obj) {
turkishButton.scaleX = 1;
turkishButton.scaleY = 1;
};
game.addChild(turkishButton);
// English language button
var englishButton = new CategoryButton(languageTexts[currentLanguage].english);
englishButton.x = 1348;
englishButton.y = 750;
if (currentLanguage === 'en') {
englishButton.alpha = 1.0; // Fully visible when selected
} else {
englishButton.alpha = 0.6; // Dimmed when not selected
}
englishButton.down = function (x, y, obj) {
englishButton.scaleX = 0.95;
englishButton.scaleY = 0.95;
currentLanguage = 'en';
storage.currentLanguage = currentLanguage;
showSettings(); // Refresh settings screen
};
englishButton.up = function (x, y, obj) {
englishButton.scaleX = 1;
englishButton.scaleY = 1;
};
game.addChild(englishButton);
// Reset data button
var resetButton = new CategoryButton(languageTexts[currentLanguage].resetData);
resetButton.x = 1024;
resetButton.y = 950;
resetButton.down = function (x, y, obj) {
resetButton.scaleX = 0.95;
resetButton.scaleY = 0.95;
showResetConfirmation();
};
resetButton.up = function (x, y, obj) {
resetButton.scaleX = 1;
resetButton.scaleY = 1;
};
game.addChild(resetButton);
// Back to menu button
var backButton = new CategoryButton(languageTexts[currentLanguage].backToMenu);
backButton.x = 1024;
backButton.y = 1200;
backButton.down = function (x, y, obj) {
backButton.scaleX = 0.95;
backButton.scaleY = 0.95;
initializeMenu();
};
backButton.up = function (x, y, obj) {
backButton.scaleX = 1;
backButton.scaleY = 1;
};
game.addChild(backButton);
updateCoinDisplay();
}
function showResetConfirmation() {
game.removeChildren();
gameState = 'resetConfirm';
// Confirmation title
var title = new Text2(languageTexts[currentLanguage].resetConfirm, {
size: 100,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 500;
game.addChild(title);
// Warning text showing what will be deleted - with better spacing
var warningText1 = new Text2('Silinecek veriler:', {
size: 80,
fill: 0xFF0000
});
warningText1.anchor.set(0.5, 0.5);
warningText1.x = 1024;
warningText1.y = 680;
game.addChild(warningText1);
var warningText2 = new Text2('• Tüm çözülmüş logolar', {
size: 65,
fill: 0xFF0000
});
warningText2.anchor.set(0.5, 0.5);
warningText2.x = 1024;
warningText2.y = 770;
game.addChild(warningText2);
var warningText3 = new Text2('• Kategori ilerlemeleri', {
size: 65,
fill: 0xFF0000
});
warningText3.anchor.set(0.5, 0.5);
warningText3.x = 1024;
warningText3.y = 840;
game.addChild(warningText3);
var warningText4 = new Text2('• İpucu verileri', {
size: 65,
fill: 0xFF0000
});
warningText4.anchor.set(0.5, 0.5);
warningText4.x = 1024;
warningText4.y = 910;
game.addChild(warningText4);
var warningText5 = new Text2('(Altın coinler korunacak)', {
size: 55,
fill: 0xFFD700
});
warningText5.anchor.set(0.5, 0.5);
warningText5.x = 1024;
warningText5.y = 1000;
game.addChild(warningText5);
// Yes button - positioned further left for better separation
var yesButton = new CategoryButton(languageTexts[currentLanguage].yes);
yesButton.x = 600;
yesButton.y = 1100;
// Make button smaller for better visual balance
yesButton.scaleX = 0.8;
yesButton.scaleY = 0.8;
yesButton.down = function (x, y, obj) {
yesButton.scaleX = 0.75;
yesButton.scaleY = 0.75;
// Reset all game progress except coins
storage.completedLogos = {};
completedLogos = {};
storage.completedWithoutHints = {};
completedWithoutHints = {};
storage.categoryCompletions = {
'Technology': 0,
'Football': 0,
'Cars': 0,
'Food': 0,
'Footballers': 0,
'Flags': 0,
'Games': 0
};
categoryCompletions = {
'Technology': 0,
'Football': 0,
'Cars': 0,
'Food': 0,
'Footballers': 0,
'Flags': 0,
'Games': 0
};
// Clear all hint letters from storage - properly iterate through storage keys
var storageKeysToDelete = [];
for (var key in storage) {
if (key.indexOf('_hint_') !== -1) {
storageKeysToDelete.push(key);
}
}
// Delete all hint keys
for (var k = 0; k < storageKeysToDelete.length; k++) {
delete storage[storageKeysToDelete[k]];
}
// Flash screen to show reset happened
LK.effects.flashScreen(0xFF0000, 500);
// Go back to main menu after reset
LK.setTimeout(function () {
initializeMenu();
}, 1000);
};
yesButton.up = function (x, y, obj) {
yesButton.scaleX = 0.8;
yesButton.scaleY = 0.8;
};
game.addChild(yesButton);
// No button - positioned further right for better separation
var noButton = new CategoryButton(languageTexts[currentLanguage].no);
noButton.x = 1448;
noButton.y = 1100;
// Make button smaller for better visual balance
noButton.scaleX = 0.8;
noButton.scaleY = 0.8;
noButton.down = function (x, y, obj) {
noButton.scaleX = 0.75;
noButton.scaleY = 0.75;
showSettings();
};
noButton.up = function (x, y, obj) {
noButton.scaleX = 0.8;
noButton.scaleY = 0.8;
};
game.addChild(noButton);
updateCoinDisplay();
}
function showCompletedLogo(logoData) {
game.removeChildren();
gameState = 'completed';
currentLogo = logoData;
// Logo display area - larger and more prominent visual logo
var logoAssetName = logoData.name.toLowerCase() + 'Logo';
if (logoData.name === 'Real Madrid') {
logoAssetName = 'realmadridLogo';
}
if (logoData.name === 'Manchester United') {
logoAssetName = 'manchesterLogo';
}
if (logoData.name === 'McDonalds') {
logoAssetName = 'mcdonaldsLogo';
}
if (logoData.name === 'Pizza Hut') {
logoAssetName = 'pizzahutLogo';
}
if (logoData.name === 'Instagram') {
logoAssetName = 'instagramLogo';
}
if (logoData.name === 'TikTok') {
logoAssetName = 'tiktokLogo';
}
if (logoData.name === 'Burger King') {
logoAssetName = 'burgerkingLogo';
}
if (logoData.name === 'Bayern München') {
logoAssetName = 'bayernmunchenLogo';
}
if (logoData.name === 'Galatasaray') {
logoAssetName = 'galatasarayLogo';
}
if (logoData.name === 'Tesla') {
logoAssetName = 'teslaLogo';
}
if (logoData.name === 'Lamborghini') {
logoAssetName = 'lamborghiniLogo';
}
if (logoData.name === 'Tog') {
logoAssetName = 'togLogo';
}
if (logoData.name === 'ChatGPT') {
logoAssetName = 'chatgptLogo';
}
if (logoData.name === 'Xiaomi') {
logoAssetName = 'xiaomiLogo';
}
if (logoData.name === 'Twitter') {
logoAssetName = 'xLogo';
}
if (logoData.name === 'YouTube') {
logoAssetName = 'youtubeLogo';
}
if (logoData.name === 'Netflix') {
logoAssetName = 'netflixLogo';
}
if (logoData.name === 'Spotify') {
logoAssetName = 'spotifyLogo';
}
if (logoData.name === 'WhatsApp') {
logoAssetName = 'whatsappLogo';
}
if (logoData.name === 'Telegram') {
logoAssetName = 'telegramLogo';
}
if (logoData.name === 'Discord') {
logoAssetName = 'discordLogo';
}
if (logoData.name === 'Zoom') {
logoAssetName = 'zoomLogo';
}
if (logoData.name === 'Skype') {
logoAssetName = 'skypeLogo';
}
if (logoData.name === 'PayPal') {
logoAssetName = 'paypalLogo';
}
if (logoData.name === 'Amazon') {
logoAssetName = 'amazonLogo';
}
if (logoData.name === 'eBay') {
logoAssetName = 'ebayLogo';
}
if (logoData.name === 'Uber') {
logoAssetName = 'uberLogo';
}
if (logoData.name === 'Airbnb') {
logoAssetName = 'airbnbLogo';
}
// Footballers category assets
if (logoData.name === 'Messi') {
logoAssetName = 'messiLogo';
}
if (logoData.name === 'Ronaldo') {
logoAssetName = 'ronaldoLogo';
}
if (logoData.name === 'Neymar') {
logoAssetName = 'neymarLogo';
}
if (logoData.name === 'Mbappe') {
logoAssetName = 'mbappeLogo';
}
if (logoData.name === 'Haaland') {
logoAssetName = 'haalandLogo';
}
if (logoData.name === 'Benzema') {
logoAssetName = 'benzemaLogo';
}
if (logoData.name === 'Lewandowski') {
logoAssetName = 'lewandowskiLogo';
}
if (logoData.name === 'Mesut Ozil') {
logoAssetName = 'mesutoezilLogo';
}
if (logoData.name === 'Arda Guler') {
logoAssetName = 'ardagulerLogo';
}
if (logoData.name === 'Luka Modric') {
logoAssetName = 'lukamodricLogo';
}
if (logoData.name === 'Vinicius Junior') {
logoAssetName = 'viniciusjuniorLogo';
}
if (logoData.name === 'Erling Haaland') {
logoAssetName = 'erlinghaalandLogo';
}
if (logoData.name === 'Lamin Yemal') {
logoAssetName = 'laminyemalLogo';
}
// Flags category assets
if (logoData.name === 'Turkey') {
logoAssetName = 'turkeyLogo';
}
if (logoData.name === 'Germany') {
logoAssetName = 'germanyLogo';
}
if (logoData.name === 'France') {
logoAssetName = 'franceLogo';
}
if (logoData.name === 'Spain') {
logoAssetName = 'spainLogo';
}
if (logoData.name === 'Italy') {
logoAssetName = 'italyLogo';
}
if (logoData.name === 'Brazil') {
logoAssetName = 'brazilLogo';
}
if (logoData.name === 'Argentina') {
logoAssetName = 'argentinaLogo';
}
if (logoData.name === 'England') {
logoAssetName = 'englandLogo';
}
if (logoData.name === 'Portugal') {
logoAssetName = 'portugalLogo';
}
if (logoData.name === 'Netherlands') {
logoAssetName = 'netherlandsLogo';
}
if (logoData.name === 'Russia') {
logoAssetName = 'russiaLogo';
}
if (logoData.name === 'Japan') {
logoAssetName = 'japanLogo';
}
if (logoData.name === 'South Korea') {
logoAssetName = 'southkoreaLogo';
}
if (logoData.name === 'Mexico') {
logoAssetName = 'mexicoLogo';
}
if (logoData.name === 'Canada') {
logoAssetName = 'canadaLogo';
}
if (logoData.name === 'Australia') {
logoAssetName = 'australiaLogo';
}
if (logoData.name === 'Greece') {
logoAssetName = 'greeceLogo';
}
if (logoData.name === 'Belgium') {
logoAssetName = 'belgiumLogo';
}
if (logoData.name === 'Croatia') {
logoAssetName = 'croatiaLogo';
}
if (logoData.name === 'Poland') {
logoAssetName = 'polandLogo';
}
if (logoData.name === 'Sweden') {
logoAssetName = 'swedenLogo';
}
// Games category assets
if (logoData.name === 'Minecraft') {
logoAssetName = 'minecraftLogo';
}
if (logoData.name === 'Fortnite') {
logoAssetName = 'fortniteLogo';
}
if (logoData.name === 'PUBG') {
logoAssetName = 'pubgLogo';
}
if (logoData.name === 'Among Us') {
logoAssetName = 'amongusLogo';
}
if (logoData.name === 'Clash of Clans') {
logoAssetName = 'clashofclansLogo';
}
if (logoData.name === 'Clash Royale') {
logoAssetName = 'clashroyaleLogo';
}
if (logoData.name === 'Candy Crush') {
logoAssetName = 'candycrushLogo';
}
if (logoData.name === 'Pokemon Go') {
logoAssetName = 'pokemongoLogo';
}
if (logoData.name === 'Subway Surfers') {
logoAssetName = 'subwaysurfersLogo';
}
if (logoData.name === 'Temple Run') {
logoAssetName = 'templerunLogo';
}
if (logoData.name === 'Angry Birds') {
logoAssetName = 'angrybirdsLogo';
}
if (logoData.name === 'Roblox') {
logoAssetName = 'robloxLogo';
}
if (logoData.name === 'Counter Strike') {
logoAssetName = 'counterstrikeLogo';
}
if (logoData.name === 'League of Legends') {
logoAssetName = 'leagueoflegendsLogo';
}
if (logoData.name === 'Dota 2') {
logoAssetName = 'dota2Logo';
}
if (logoData.name === 'World of Warcraft') {
logoAssetName = 'worldofwarcraftLogo';
}
if (logoData.name === 'Valorant') {
logoAssetName = 'valorantLogo';
}
if (logoData.name === 'Apex Legends') {
logoAssetName = 'apexlegendsLogo';
}
if (logoData.name === 'Call of Duty') {
logoAssetName = 'callofdutyLogo';
}
if (logoData.name === 'Grand Theft Auto') {
logoAssetName = 'grandtheftautoLogo';
}
if (logoData.name === 'Overwatch') {
logoAssetName = 'overwatchLogo';
}
if (logoData.name === 'Steam') {
logoAssetName = 'steamLogo';
}
var logoVisual = LK.getAsset(logoAssetName, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
logoVisual.x = 1024;
logoVisual.y = 500;
game.addChild(logoVisual);
// Show "COMPLETED" text
var completedText = new Text2(languageTexts[currentLanguage].completedText, {
size: 100,
fill: 0x00FF00
});
completedText.anchor.set(0.5, 0.5);
completedText.x = 1024;
completedText.y = 800;
game.addChild(completedText);
// Show the answer
var displayName = logoData.name;
if (logoData.name === 'Burger King') {
displayName = 'Burger King'; // Ensure space between Burger and King
}
if (logoData.name === 'Real Madrid') {
displayName = 'Real Madrid';
}
if (logoData.name === 'Manchester United') {
displayName = 'Manchester United';
}
if (logoData.name === 'Pizza Hut') {
displayName = 'Pizza Hut';
}
if (logoData.name === 'Bayern München') {
displayName = 'Bayern München';
}
if (logoData.name === 'Mesut Ozil') {
displayName = 'Mesut Özil';
}
if (logoData.name === 'Arda Guler') {
displayName = 'Arda Güler';
}
if (logoData.name === 'Luka Modric') {
displayName = 'Luka Modrić';
}
if (logoData.name === 'Vinicius Junior') {
displayName = 'Vinícius Jr.';
}
if (logoData.name === 'Erling Haaland') {
displayName = 'Erling Haaland';
}
if (logoData.name === 'Lamin Yemal') {
displayName = 'Lamine Yamal';
}
var answerText = new Text2(displayName, {
size: 80,
fill: 0xFFFFFF
});
answerText.anchor.set(0.5, 0.5);
answerText.x = 1024;
answerText.y = 900;
game.addChild(answerText);
// Show coin reward text
var coinRewardText = new Text2('+10', {
size: 60,
fill: 0xFFD700
});
coinRewardText.anchor.set(0.5, 0.5);
coinRewardText.x = 1024;
coinRewardText.y = 950;
game.addChild(coinRewardText);
// Add checkmark
var checkmark = LK.getAsset('checkmark', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
checkmark.x = 1024;
checkmark.y = 1050;
game.addChild(checkmark);
// Exit button
var exitBtn = new ExitButton();
exitBtn.x = 1024;
exitBtn.y = 1300;
exitBtn.down = function (x, y, obj) {
exitBtn.scaleX = 0.95;
exitBtn.scaleY = 0.95;
showCategoryLogos(currentCategory); // Return to category view
};
exitBtn.up = function (x, y, obj) {
exitBtn.scaleX = 1;
exitBtn.scaleY = 1;
};
game.addChild(exitBtn);
updateCoinDisplay();
}
function checkAnswer() {
var playerAnswer = '';
for (var i = 0; i < answerSlots.length; i++) {
var slot = answerSlots[i];
if (slot.occupiedLetter) {
playerAnswer += slot.occupiedLetter.letter;
} else {
return; // Not all slots filled
}
}
// Get the appropriate answer based on language and category
var correctAnswer = currentLogo.answer;
if (currentCategory === 'Flags' && currentLanguage === 'tr' && currentLogo.answerTR) {
correctAnswer = currentLogo.answerTR;
}
if (playerAnswer === correctAnswer) {
// Correct answer
goldCoins += 20;
storage.goldCoins = goldCoins;
// Mark logo as completed
var logoKey = currentCategory + '_' + currentLogo.name;
if (!completedLogos[logoKey]) {
completedLogos[logoKey] = true;
storage.completedLogos = completedLogos;
// Only count towards hint-free completion tracking if no hint was used
if (!currentLogoUsedHint) {
completedWithoutHints[logoKey] = true;
storage.completedWithoutHints = completedWithoutHints;
}
// Update category completions - count all completed logos for category unlocking
updateCategoryCompletions();
}
LK.getSound('correctAnswer').play();
LK.getSound('coinEarned').play();
LK.effects.flashScreen(0x00FF00, 500);
LK.setTimeout(function () {
showCategoryLogos(currentCategory);
}, 1000);
} else {
// Wrong answer - flash all answer slots red using optimized method
var wrongAnswerSlots = [];
for (var j = 0; j < answerSlots.length; j++) {
if (answerSlots[j] && answerSlots[j].letterCopy) {
wrongAnswerSlots.push(answerSlots[j].letterCopy);
}
}
// Batch tween operations for better performance
if (wrongAnswerSlots.length > 0) {
for (var k = 0; k < wrongAnswerSlots.length; k++) {
var letterRef = wrongAnswerSlots[k];
letterRef.tint = 0xFF0000;
// Use single tween back to normal instead of chained tweens
tween(letterRef, {
tint: 0xFFFFFF
}, {
duration: 500,
delay: 200
});
}
}
// Also flash the screen red briefly
LK.effects.flashScreen(0xFF0000, 300);
}
}
function handleMove(x, y, obj) {
// Move handler no longer needed for letter dragging
}
game.move = handleMove;
game.up = function (x, y, obj) {
// Up handler no longer needed for letter dragging
};
// Performance optimization variables
var lastFrameTime = 0;
var targetFPS = 60;
var frameInterval = 1000 / targetFPS;
// Optimize memory management
var memoryCleanupCounter = 0;
game.update = function () {
// Limit frame rate for stability
var currentTime = Date.now();
if (currentTime - lastFrameTime < frameInterval) {
return;
}
lastFrameTime = currentTime;
// Periodic memory cleanup
memoryCleanupCounter++;
if (memoryCleanupCounter > 300) {
// Every 5 seconds at 60fps
memoryCleanupCounter = 0;
// Force garbage collection hints
if (window.gc) {
window.gc();
}
}
};
// Welcome menu state
function showWelcomeMenu() {
game.removeChildren();
gameState = 'welcome';
// Title
var title = new Text2('Logo Quiz', {
size: 150,
fill: 0xFFFFFF
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 600;
game.addChild(title);
// Subtitle
var subtitle = new Text2('Hoşgeldiniz!', {
size: 100,
fill: 0xFFD700
});
subtitle.anchor.set(0.5, 0.5);
subtitle.x = 1024;
subtitle.y = 750;
game.addChild(subtitle);
// Play button
var playButton = new CategoryButton('Oynamaya Başla');
playButton.x = 1024;
playButton.y = 1050;
playButton.down = function (x, y, obj) {
playButton.scaleX = 0.95;
playButton.scaleY = 0.95;
showCategorySelection();
};
playButton.up = function (x, y, obj) {
playButton.scaleX = 1;
playButton.scaleY = 1;
};
game.addChild(playButton);
// Warning text about logo colors
var warningText = new Text2('Tüm logoların resmi olmayabilir', {
size: 65,
//{pv_1}
fill: 0xFF0000 //{pv_2}
}); //{pv_3}
warningText.anchor.set(0.5, 0.5); //{pv_4}
warningText.x = 1024; //{pv_5}
warningText.y = 1250; //{pv_6}
game.addChild(warningText); //{pv_7}
updateCoinDisplay();
}
// Initialize the game with welcome menu
showWelcomeMenu();