/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var LetterTile = Container.expand(function (letter, index) {
var self = Container.call(this);
var background = self.attachAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
var letterText = new Text2(letter.toUpperCase(), {
size: 50,
fill: 0x333333
});
letterText.anchor.set(0.5, 0.5);
self.addChild(letterText);
self.letter = letter;
self.index = index;
self.isSelected = false;
self.background = background;
self.letterText = letterText;
self.setSelected = function (selected) {
self.isSelected = selected;
if (selected) {
self.background.tint = 0x4CAF50;
// Add glow effect for selected tiles
self.background.scaleX = 1.1;
self.background.scaleY = 1.1;
} else {
self.background.tint = 0xffffff;
self.background.scaleX = 1.0;
self.background.scaleY = 1.0;
}
};
self.down = function (x, y, obj) {
if (gameState === 'playing') {
// Start drag selection
isDragging = true;
dragStartTile = self;
lastDraggedTile = self;
// Clear previous selection
for (var i = 0; i < selectedLetters.length; i++) {
selectedLetters[i].setSelected(false);
}
selectedLetters = [];
// Add this letter as the first in sequence
selectedLetters.push(self);
self.setSelected(true);
updateCurrentWord();
updateSequenceDisplay();
LK.getSound('buttonClick').play();
}
};
// Add move handler for drag selection
self.move = function (x, y, obj) {
if (gameState === 'playing' && isDragging && self !== lastDraggedTile) {
// Add this letter to selection if not already selected
var alreadySelected = false;
for (var i = 0; i < selectedLetters.length; i++) {
if (selectedLetters[i] === self) {
alreadySelected = true;
break;
}
}
if (!alreadySelected) {
selectedLetters.push(self);
self.setSelected(true);
lastDraggedTile = self;
updateCurrentWord();
updateSequenceDisplay();
}
}
};
// Add up handler to detect when dragging over this tile
self.up = function (x, y, obj) {
if (gameState === 'playing' && isDragging) {
// This will be handled by the game's global up handler
}
};
return self;
});
var WordItem = Container.expand(function (word, points) {
var self = Container.call(this);
var background = self.attachAsset('wordBackground', {
anchorX: 0,
anchorY: 0.5
});
background.alpha = 0.8;
var wordText = new Text2(word.toUpperCase(), {
size: 36,
fill: 0x333333
});
wordText.anchor.set(0, 0.5);
wordText.x = 15;
self.addChild(wordText);
var pointText = new Text2('+' + points, {
size: 30,
fill: 0x4CAF50
});
pointText.anchor.set(1, 0.5);
pointText.x = 580;
self.addChild(pointText);
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xffffff
});
/****
* Game Code
****/
// Game data and word lists - 1000 levels total with difficulty progression every 300 levels
// Background assets for futuristic themes every 50 levels
var _wordAlternatives;
function _typeof2(o) {
"@babel/helpers - typeof";
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof2(o);
}
function _defineProperty2(e, r, t) {
return (r = _toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _toPropertyKey2(t) {
var i = _toPrimitive2(t, "string");
return "symbol" == _typeof2(i) ? i : i + "";
}
function _toPrimitive2(t, r) {
if ("object" != _typeof2(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof2(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _defineProperty(e, r, t) {
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var currentLanguage = 'english';
var turkishWordLists = [];
var englishWordLists = [];
var wordLists = [];
// Language strings
var languageStrings = {
turkish: {
title: 'KELİME OYUNU',
start: 'BAŞLAT',
money: 'PARA',
level: 'SEVİYE',
languageSelection: 'DİL SEÇİMİ:',
buyHint: 'İPUCU SATIN AL',
oneHint: '1 İPUCU = 50 PARA',
yourMoney: 'PARAN',
buy: 'SATIN AL',
back: 'GERİ',
send: 'GÖNDER',
clear: 'TEMİZLE',
hint: 'İPUCU',
buyHintShort: 'İPUCU\nAL',
menu: 'MENÜ',
score: 'SKOR',
hintText: 'İPUCU: ',
completedAll: 'TEBRİKLER! TÜM SEVİYELERİ TAMAMLADINIZ!',
bonusHint: '+1 İPUCU BONUS!'
},
english: {
title: 'WORD GAME',
start: 'START',
money: 'COINS',
level: 'LEVEL',
languageSelection: 'LANGUAGE:',
buyHint: 'BUY HINT',
oneHint: '1 HINT = 50 COINS',
yourMoney: 'YOUR COINS',
buy: 'BUY',
back: 'BACK',
send: 'SUBMIT',
clear: 'CLEAR',
hint: 'HINT',
buyHintShort: 'BUY\nHINT',
menu: 'MENU',
score: 'SCORE',
hintText: 'HINTS: ',
completedAll: 'CONGRATULATIONS! ALL LEVELS COMPLETED!',
bonusHint: '+1 HINT BONUS!'
}
};
// Function to get localized string
function getString(key) {
return languageStrings[currentLanguage][key] || key;
}
// Alphabet definitions
var turkishAlphabet = 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ';
var englishAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function getAlphabet() {
return currentLanguage === 'turkish' ? turkishAlphabet : englishAlphabet;
}
// EASY LEVELS (1-50): Only the main word can be found
var easyWords = ["KALEM", "KITAP", "OKUL", "MASA", "KEDI", "KOPEK", "ELMA", "ARMUT", "SEKER", "EKMEK", "GUNES", "YAGMUR", "KARLI", "SICAK", "SOGUK", "MUTLU", "UZGUN", "HIZLI", "YAVAS", "BUYUK", "KUCUK", "UZUN", "KISA", "GENIS", "DAR", "YENI", "ESKI", "GUZEL", "CIRKIN", "TEMIZ", "KIRLI", "BEYAZ", "SIYAH", "KIRMIZI", "MAVI", "YESIL", "SARI", "PEMBE", "MOR", "TURUNCU", "DOKTOR", "OGRETMEN", "POLIS", "ITFAIYE", "ASCI", "BERBER", "TERZI", "KAPICI", "GARSON", "SOFOR"];
for (var i = 0; i < 50; i++) {
turkishWordLists.push({
word: easyWords[i],
words: [],
alternatives: []
});
}
// MEDIUM LEVELS (51-100): Main word + 1 sub-word that can be made from the letters
var mediumLevels = [{
word: "PENCERE",
words: ["PEN"]
}, {
word: "TABLETU",
words: ["TAB"]
}, {
word: "KAHVALT",
words: ["KAH"]
}, {
word: "OKUYUCU",
words: ["OKU"]
}, {
word: "YAZILIM",
words: ["YAZ"]
}, {
word: "GELISIM",
words: ["GEL"]
}, {
word: "MUTLULUK",
words: ["MUT"]
}, {
word: "DOSTLUK",
words: ["DOS"]
}, {
word: "KARDESLIK",
words: ["KAR"]
}, {
word: "SEVGILIK",
words: ["SEV"]
}, {
word: "OYUNCAK",
words: ["OYN"]
}, {
word: "KITAPLIK",
words: ["KIT"]
}, {
word: "MASALAR",
words: ["MAS"]
}, {
word: "EVLERDE",
words: ["EV"]
}, {
word: "SEHIRLER",
words: ["SEH"]
}, {
word: "AILELER",
words: ["AIL"]
}, {
word: "ARKADAS",
words: ["ARK"]
}, {
word: "MERHABA",
words: ["MER"]
}, {
word: "GUNAYDIN",
words: ["GUN"]
}, {
word: "TESEKKUR",
words: ["TES"]
}, {
word: "HOSGELDIN",
words: ["HOS"]
}, {
word: "GORUSMEK",
words: ["GOR"]
}, {
word: "HABERLER",
words: ["HAB"]
}, {
word: "GELECEK",
words: ["GEL"]
}, {
word: "ZAMANLAR",
words: ["ZAM"]
}, {
word: "DUNYADA",
words: ["DUN"]
}, {
word: "HAYATTA",
words: ["HAY"]
}, {
word: "BILGILER",
words: ["BIL"]
}, {
word: "DERSLERI",
words: ["DER"]
}, {
word: "OGRETMEN",
words: ["OGR"]
}, {
word: "OKULLAR",
words: ["OKL"]
}, {
word: "EVIMIZDE",
words: ["EVI"]
}, {
word: "AILELERIMIZ",
words: ["AIL"]
}, {
word: "ARKADALAR",
words: ["ARK"]
}, {
word: "DOSTLUK",
words: ["DOS"]
}, {
word: "SEVGILIK",
words: ["SEV"]
}, {
word: "MUTLULUK",
words: ["MUT"]
}, {
word: "KAHVALTI",
words: ["KAH"]
}, {
word: "YEMEKLER",
words: ["YEM"]
}, {
word: "ICECEKLER",
words: ["ICE"]
}, {
word: "MEYVELER",
words: ["MEY"]
}, {
word: "SEBZELER",
words: ["SEB"]
}, {
word: "ETKINLIK",
words: ["ETK"]
}, {
word: "OYUNLAR",
words: ["OYN"]
}, {
word: "SPORCULAR",
words: ["SPO"]
}, {
word: "SANATCI",
words: ["SAN"]
}, {
word: "MUZISYEN",
words: ["MUZ"]
}, {
word: "RESSAMLAR",
words: ["RES"]
}, {
word: "YAZARLAR",
words: ["YAZ"]
}, {
word: "SAIRLER",
words: ["SAI"]
}, {
word: "FILMLER",
words: ["FIL"]
}, {
word: "DIZILER",
words: ["DIZ"]
}];
for (var i = 0; i < 50; i++) {
var levelData = mediumLevels[i];
levelData.alternatives = levelData.alternatives || [];
turkishWordLists.push(levelData);
}
// HARD LEVELS (101-150): Main word + 3 sub-words that can be made from the letters
var hardLevels = [{
word: "BILGISAYAR",
words: ["BIL", "GIS", "AYA"]
}, {
word: "TELEVIZYON",
words: ["TEL", "VIZ", "YON"]
}, {
word: "TELEFON",
words: ["TEL", "FON", "ELF"]
}, {
word: "INTERNET",
words: ["INT", "NET", "TER"]
}, {
word: "BILGILER",
words: ["BIL", "GIL", "LER"]
}, {
word: "PROGRAM",
words: ["PRO", "RAM", "GRA"]
}, {
word: "SISTEMI",
words: ["SIS", "TEM", "EMI"]
}, {
word: "TEKNOLOJI",
words: ["TEK", "NOL", "LOJ"]
}, {
word: "MATEMATIK",
words: ["MAT", "TEM", "TIK"]
}, {
word: "GEOMETRI",
words: ["GEO", "MET", "TRI"]
}, {
word: "COGRAFYA",
words: ["COG", "RAF", "YAF"]
}, {
word: "TARIH",
words: ["TAR", "IH", "HI"]
}, {
word: "EDEBIYAT",
words: ["EDE", "BIY", "YAT"]
}, {
word: "FIZIK",
words: ["FIZ", "ZIK", "IK"]
}, {
word: "KIMYA",
words: ["KIM", "MYA", "YA"]
}, {
word: "BIYOLOJI",
words: ["BIY", "OLO", "LOJ"]
}, {
word: "INGILIZCE",
words: ["ING", "LIZ", "ZCE"]
}, {
word: "FRANSIZCA",
words: ["FRA", "SIZ", "ZCA"]
}, {
word: "ALMANCA",
words: ["ALM", "MAN", "ANC"]
}, {
word: "TURKCE",
words: ["TUR", "KCE", "CE"]
}, {
word: "RESIM",
words: ["RES", "SIM", "IM"]
}, {
word: "MUZIK",
words: ["MUZ", "ZIK", "IK"]
}, {
word: "BEDEN",
words: ["BED", "DEN", "EN"]
}, {
word: "SAGLIK",
words: ["SAG", "LIK", "IK"]
}, {
word: "SPOR",
words: ["SPO", "OR", "R"]
}, {
word: "FUTBOL",
words: ["FUT", "BOL", "OL"]
}, {
word: "BASKETBOL",
words: ["BAS", "KET", "BOL"]
}, {
word: "VOLEYBOL",
words: ["VOL", "EY", "BOL"]
}, {
word: "TENIS",
words: ["TEN", "NIS", "IS"]
}, {
word: "YUZME",
words: ["YUZ", "ZME", "ME"]
}, {
word: "KOSU",
words: ["KOS", "OSU", "SU"]
}, {
word: "BISIKLET",
words: ["BIS", "IK", "LET"]
}, {
word: "OTOMOBIL",
words: ["OTO", "MOB", "BIL"]
}, {
word: "OTOBUS",
words: ["OTO", "BUS", "US"]
}, {
word: "TREN",
words: ["TR", "REN", "EN"]
}, {
word: "UCAK",
words: ["UC", "CAK", "AK"]
}, {
word: "GEMI",
words: ["GEM", "EMI", "MI"]
}, {
word: "BISIKLET",
words: ["BIS", "IK", "LET"]
}, {
word: "MOTOSIKLET",
words: ["MOT", "SIK", "LET"]
}, {
word: "TAKMISI",
words: ["TAK", "MIS", "SI"]
}, {
word: "OYUNCU",
words: ["OY", "YUN", "CU"]
}, {
word: "HAKEM",
words: ["HAK", "KEM", "EM"]
}, {
word: "ANTRENOR",
words: ["ANT", "REN", "NOR"]
}, {
word: "SAYGIN",
words: ["SAY", "YGI", "GIN"]
}, {
word: "BASARI",
words: ["BAS", "SAR", "ARI"]
}, {
word: "GALIBIYET",
words: ["GAL", "IBY", "YET"]
}, {
word: "MAGLUBIYE",
words: ["MAG", "LUB", "BIY"]
}, {
word: "BERABERE",
words: ["BER", "RAB", "ERE"]
}, {
word: "TAKIMLAR",
words: ["TAK", "KIM", "LAR"]
}, {
word: "TURNUVA",
words: ["TUR", "NUV", "VAL"]
}, {
word: "SAMPIYONLUK",
words: ["SAM", "PIY", "LUK"]
}];
for (var i = 0; i < 50; i++) {
var levelData = hardLevels[i];
levelData.alternatives = levelData.alternatives || [];
turkishWordLists.push(levelData);
}
// Generate 1000 English word levels with difficulty progression every 300 levels
// EASY LEVELS (1-300): Only the main word can be found - unique words only
var englishEasyWords = ["APPLE", "BREAD", "CHAIR", "DANCE", "EAGLE", "FIELD", "GRAPE", "HORSE", "ISLAND", "JUICE", "KNIFE", "LIGHT", "MAGIC", "NIGHT", "OCEAN", "PEACE", "QUEEN", "RIVER", "STONE", "TIGER", "UNITY", "VOICE", "WATER", "YOUTH", "ZEBRA", "BEACH", "CANDY", "DREAM", "EARTH", "FLAME", "GIANT", "HONEY", "IMAGE", "JEWEL", "KITE", "LEMON", "MOUSE", "NURSE", "OPERA", "PIANO", "QUIET", "ROBOT", "STORM", "TRAIN", "UNDER", "VALLEY", "WITCH", "XRAY", "YOUNG", "ZIGZAG", "BRIDGE", "CASTLE", "DESERT", "ENGINE", "FOREST", "GARDEN", "HAMMER", "INSECT", "JACKET", "KITTEN", "LADDER", "MARKET", "NEEDLE", "ORANGE", "PARROT", "RABBIT", "SILVER", "TURKEY", "UNCLE", "VIOLET", "WINDOW", "YELLOW", "BARREL", "CANDLE", "DOLPHIN", "EMPEROR", "FINGER", "GOLDEN", "HELMET", "IGLOO", "JUNGLE", "KERNEL", "LIZARD", "MIRROR", "NEPHEW", "OXYGEN", "PEPPER", "QUARTZ", "RAINBOW", "SHADOW", "TEMPLE", "UPWARD", "VELVET", "WIZARD", "XYLEM", "YOGURT", "ZEPHYR", "ARCTIC", "BUTTON", "CIRCLE", "DONKEY", "ELEVEN", "FROZEN", "GUITAR", "HUNTER", "INSANE", "JOYFUL", "KETTLE", "LEGEND", "MONKEY", "NEPHEW", "OFFICE", "POETRY", "QUIVER", "RIDDLE", "SIMPLE", "TIMBER", "UPSIDE", "VECTOR", "WISDOM", "XENIAL", "YONDER", "ZOMBIE", "BUCKET", "COUGAR", "DOLLAR", "EXPERT", "FOLDER", "GLOBAL", "HAMMER", "INDOOR", "JUNGLE", "KERNEL", "LINEAR", "MENTAL", "NORMAL", "ORIENT", "PENCIL", "QUORUM", "RENDER", "SPIRAL", "TOWARD", "UNBIND", "VISUAL", "WINTER", "XENON", "YODEL", "ZONAL", "ABRUPT", "BINARY", "CURSOR", "DEEPLY", "EXOTIC", "FORMAL", "GALAXY", "HYBRID", "IMPACT", "JUNIOR", "KINETIC", "LATERAL", "MANUAL", "NEURAL", "OXYGEN", "POLAR", "QUANTUM", "RANDOM", "STELLAR", "TREMOR", "UPWARD", "VERBAL", "WAIVER", "XERUS", "YEARLY", "ZENITH", "BLAZER", "CIPHER", "DYNAMO", "EQUINE", "FUSION", "GALAXY", "HERALD", "IMPACT", "JUMPER", "KNIGHT", "LINEAR", "MATRIX", "NEXUS", "ORIENT", "PRISM", "QUASAR", "RADIUS", "SECTOR", "TERROR", "UPLINK", "VECTOR", "WHISPER", "XENITH", "YOGIC", "ZIPPER", "BIONIC", "COSMIC", "DOMAIN", "ENIGMA", "FABRIC", "GADGET", "HARBOR", "INFLUX", "JIGSAW", "KERNEL", "LEGION", "MODERN", "NIMBUS", "ORIGIN", "PHOTON", "QUARRY", "REFORM", "SUMMIT", "TENSOR", "ULTIMA", "VERTEX", "WANDER", "XEBEC", "YELLOW", "ZYGOTE", "BEACON", "CHROME", "DEPLOY", "EVOLVE", "FACILE", "GENIUS", "HOLLOW", "INSURE", "JUNGLE", "KINSHIP", "LAUNCH", "MELODY", "NOTION", "OUTPUT", "PLEDGE", "QUARTZ", "RESCUE", "SYMBOL", "TENSOR", "UNIQUE", "VOYAGE", "WARMTH", "XENIAL", "YONDER", "ZODIAC", "BINARY", "COSMIC", "DEEPLY", "ENIGMA", "FABRIC", "GLOBAL", "HELMET", "INFLUX", "JUNGLE", "KINDLE", "LINEAR", "METEOR", "NEURAL", "OPTICS", "PLASMA", "QUORUM", "ROBUST", "SYSTEM", "TENSOR", "UNIQUE", "VECTOR", "WISDOM", "XENIAL", "YOGURT", "ZENITH", "BLAZER", "CIPHER", "DOMAIN", "EVOLVE", "FABRIC", "GOLDEN", "HOLDER", "IMPACT", "JUNGLE", "KERNEL", "LEGEND", "MATRIX", "NOTION", "ORIGIN", "PLASMA", "QUARRY", "RADIUS", "SPIRAL", "TIMBER", "UNIQUE", "VOYAGE", "WISDOM", "XENIAL", "YOGURT", "ZYGOTE"];
// Define word alternatives - words that can have multiple valid spellings
var wordAlternatives = (_wordAlternatives = {
// Common confusing spellings
"FIELD": ["FILED"],
"FILED": ["FIELD"],
"FRIEND": ["FREIND"],
"FREIND": ["FRIEND"],
"PIECE": ["PEICE"],
"PEICE": ["PIECE"],
"RECEIVE": ["RECIEVE"],
"RECIEVE": ["RECEIVE"],
"BELIEVE": ["BELEIVE"],
"BELEIVE": ["BELIEVE"],
"ACHIEVE": ["ACHEIVE"],
"ACHEIVE": ["ACHIEVE"],
"THEIR": ["THIER"],
"THIER": ["THEIR"],
"WEIRD": ["WIERD"],
"WIERD": ["WEIRD"],
"SCIENCE": ["SCINCE"],
"SCINCE": ["SCIENCE"],
"DEFINITE": ["DEFINATE"],
"DEFINATE": ["DEFINITE"],
"SEPARATE": ["SEPERATE"],
"SEPERATE": ["SEPARATE"],
"NECESSARY": ["NECCESSARY"],
"NECCESSARY": ["NECESSARY"],
"OCCURRED": ["OCCURED"],
"OCCURED": ["OCCURRED"],
"BEGINNING": ["BEGINING"],
"BEGINING": ["BEGINNING"],
"BEAUTIFUL": ["BEATIFUL"],
"BEATIFUL": ["BEAUTIFUL"],
"CALENDAR": ["CALENDER"],
"CALENDER": ["CALENDAR"],
"CEMETERY": ["CEMETARY"],
"CEMETARY": ["CEMETERY"],
"CONSCIOUS": ["CONCIOUS"],
"CONCIOUS": ["CONSCIOUS"],
"DEFINITELY": ["DEFINATELY"],
"DEFINATELY": ["DEFINITELY"],
"EMBARRASS": ["EMBARASS"],
"EMBARASS": ["EMBARRASS"],
"ENVIRONMENT": ["ENVIROMENT"],
"ENVIROMENT": ["ENVIRONMENT"],
"GOVERNMENT": ["GOVERMENT"],
"GOVERMENT": ["GOVERNMENT"],
"INDEPENDENT": ["INDEPENDANT"],
"INDEPENDANT": ["INDEPENDENT"],
"INTELLIGENCE": ["INTELIGENCE"],
"INTELIGENCE": ["INTELLIGENCE"],
"KNOWLEDGE": ["KNOWLEGE"],
"KNOWLEGE": ["KNOWLEDGE"],
"LANGUAGE": ["LANGUEGE"],
"LANGUEGE": ["LANGUAGE"],
"MAINTENANCE": ["MAINTAINENCE"],
"MAINTAINENCE": ["MAINTENANCE"],
"NOTICEABLE": ["NOTICABLE"],
"NOTICABLE": ["NOTICEABLE"],
"OCCURRENCE": ["OCCURENCE"],
"OCCURENCE": ["OCCURRENCE"],
"PRIVILEGE": ["PRIVILEDGE"],
"PRIVILEDGE": ["PRIVILEGE"],
"RESTAURANT": ["RESTARAUNT"],
"RESTARAUNT": ["RESTAURANT"],
"TOMORROW": ["TOMAROW", "TOMMOROW"],
"TOMAROW": ["TOMORROW"],
"TOMMOROW": ["TOMORROW"],
"VACUUM": ["VACCUUM"],
"VACCUUM": ["VACUUM"],
// British vs American spellings
"COLOR": ["COLOUR"],
"COLOUR": ["COLOR"],
"HONOR": ["HONOUR"],
"HONOUR": ["HONOR"],
"FAVOR": ["FAVOUR"],
"FAVOUR": ["FAVOR"],
"FLAVOR": ["FLAVOUR"],
"FLAVOUR": ["FLAVOR"],
"LABOR": ["LABOUR"],
"LABOUR": ["LABOR"],
"NEIGHBOR": ["NEIGHBOUR"],
"NEIGHBOUR": ["NEIGHBOR"],
"RUMOR": ["RUMOUR"],
"RUMOUR": ["RUMOR"],
"HUMOR": ["HUMOUR"],
"HUMOUR": ["HUMOR"],
"VAPOR": ["VAPOUR"],
"VAPOUR": ["VAPOR"],
"BEHAVIOR": ["BEHAVIOUR"],
"BEHAVIOUR": ["BEHAVIOR"],
"CENTER": ["CENTRE"],
"CENTRE": ["CENTER"],
"METER": ["METRE"],
"METRE": ["METER"],
"FIBER": ["FIBRE"],
"FIBRE": ["FIBER"],
"LITER": ["LITRE"],
"LITRE": ["LITER"],
"THEATER": ["THEATRE"],
"THEATRE": ["THEATER"],
"DEFENSE": ["DEFENCE"],
"DEFENCE": ["DEFENSE"],
"LICENSE": ["LICENCE"],
"LICENCE": ["LICENSE"],
"PRACTICE": ["PRACTISE"],
"PRACTISE": ["PRACTICE"],
"REALIZE": ["REALISE"],
"REALISE": ["REALIZE"],
"ORGANIZE": ["ORGANISE"],
"ORGANISE": ["ORGANIZE"],
"ANALYZE": ["ANALYSE"],
"ANALYSE": ["ANALYZE"],
"RECOGNIZE": ["RECOGNISE"],
"RECOGNISE": ["RECOGNIZE"],
"CRITICIZE": ["CRITICISE"],
"CRITICISE": ["CRITICIZE"],
"MEMORIZE": ["MEMORISE"],
"MEMORISE": ["MEMORIZE"],
"APOLOGIZE": ["APOLOGISE"],
"APOLOGISE": ["APOLOGIZE"],
"CATALOG": ["CATALOGUE"],
"CATALOGUE": ["CATALOG"],
"DIALOG": ["DIALOGUE"],
"DIALOGUE": ["DIALOG"],
"TRAVELER": ["TRAVELLER"],
"TRAVELLER": ["TRAVELER"],
"COUNSELOR": ["COUNSELLOR"],
"COUNSELLOR": ["COUNSELOR"],
"JEWELRY": ["JEWELLERY"],
"JEWELLERY": ["JEWELRY"],
"GRAY": ["GREY"],
"GREY": ["GRAY"],
// Turkish alternatives
"KALEM": ["QALAM"],
"QALAM": ["KALEM"],
"KITAP": ["KITAB"],
"KITAB": ["KITAP"],
"GUNES": ["GÜNES"],
"GÜNES": ["GUNES"],
"YAGMUR": ["YAĞMUR"],
"YAĞMUR": ["YAGMUR"],
"SICAK": ["SICAK"]
}, _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "SICAK", ["SICAK"]), "SOGUK", ["SOĞUK"]), "SOĞUK", ["SOGUK"]), "BUYUK", ["BÜYÜK"]), "BÜYÜK", ["BUYUK"]), "KUCUK", ["KÜÇÜK"]), "KÜÇÜK", ["KUCUK"]), "GENIS", ["GENİS"]), "GENİS", ["GENIS"]), "GUZEL", ["GÜZEL"]), _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "GÜZEL", ["GUZEL"]), "CIRKIN", ["ÇİRKİN"]), "ÇİRKİN", ["CIRKIN"]), "TEMIZ", ["TEMİZ"]), "TEMİZ", ["TEMIZ"]), "KIRLI", ["KİRLİ"]), "KİRLİ", ["KIRLI"]), "KIRMIZI", ["KIRMIZI"]), "KIRMIZI", ["KIRMIZI"]), "YESIL", ["YEŞİL"]), _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "YEŞİL", ["YESIL"]), "SARI", ["SARI"]), "SARI", ["SARI"]), "PEMBE", ["PEMBE"]), "PEMBE", ["PEMBE"]), "TURUNCU", ["TURUNCU"]), "TURUNCU", ["TURUNCU"]), "OGRETMEN", ["ÖĞRETMEN"]), "ÖĞRETMEN", ["OGRETMEN"]), "ITFAIYE", ["İTFAİYE"]), _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "İTFAİYE", ["ITFAIYE"]), "ASCI", ["AŞÇI"]), "AŞÇI", ["ASCI"]), "SOFOR", ["ŞOFÖR"]), "ŞOFÖR", ["SOFOR"]));
// Function to check if a word has valid alternatives
function getWordAlternatives(word) {
if (!word) return []; // Return empty array if word is undefined or null
var upperWord = word.toUpperCase();
return wordAlternatives[upperWord] || [];
}
// Generate 300 easy levels - each word appears only once
for (var i = 0; i < 300; i++) {
var mainWord = englishEasyWords[i];
var alternatives = getWordAlternatives(mainWord);
englishWordLists.push({
word: mainWord,
words: [],
alternatives: alternatives
});
}
// MEDIUM LEVELS (301-600): Main word + 1-2 sub-words - ensure sub-words can be made from main word letters
var englishMediumLevels = [{
word: "STREAM",
words: ["TEAM"]
}, {
word: "PLAYER",
words: ["PLAY"]
}, {
word: "MASTER",
words: ["TEAM"]
}, {
word: "WINTER",
words: ["WIN"]
}, {
word: "PLANET",
words: ["PLAN"]
}, {
word: "GARDEN",
words: ["RAGE"]
}, {
word: "LISTEN",
words: ["NEST"]
}, {
word: "DANCER",
words: ["RACE"]
}, {
word: "FRIEND",
words: ["FIRE"]
}, {
word: "MOTHER",
words: ["OTHER"]
}, {
word: "FATHER",
words: ["EARTH"]
}, {
word: "SISTER",
words: ["REST"]
}, {
word: "BROTHER",
words: ["OTHER"]
}, {
word: "TEACHER",
words: ["TEACH"]
}, {
word: "STUDENT",
words: ["NEST"]
}, {
word: "PAINTER",
words: ["PAINT"]
}, {
word: "WRITER",
words: ["WRITE"]
}, {
word: "READER",
words: ["READ"]
}, {
word: "DRIVER",
words: ["DRIVE"]
}, {
word: "SINGER",
words: ["RING"]
}, {
word: "DANCER",
words: ["DANCE"]
}, {
word: "WORKER",
words: ["WORK"]
}, {
word: "HELPER",
words: ["HELP"]
}, {
word: "LEADER",
words: ["LEAD"]
}, {
word: "FINDER",
words: ["FIND"]
}, {
word: "KEEPER",
words: ["KEEP"]
}, {
word: "LOSER",
words: ["LOSE"]
}, {
word: "WINNER",
words: ["WIN"]
}, {
word: "RUNNER",
words: ["RUN"]
}, {
word: "WALKER",
words: ["WALK"]
}, {
word: "TALKER",
words: ["TALK"]
}, {
word: "THINKER",
words: ["THINK"]
}, {
word: "DREAMER",
words: ["DREAM"]
}, {
word: "SLEEPER",
words: ["SLEEP"]
}, {
word: "WATCHER",
words: ["WATCH"]
}, {
word: "LISTENER",
words: ["LISTEN"]
}, {
word: "SPEAKER",
words: ["SPEAK"]
}, {
word: "CREATOR",
words: ["CREATE"]
}, {
word: "BUILDER",
words: ["BUILD"]
}, {
word: "FIGHTER",
words: ["FIGHT"]
}, {
word: "CLIMBER",
words: ["CLIMB"]
}, {
word: "SWIMMER",
words: ["SWIM"]
}, {
word: "JUMPER",
words: ["JUMP"]
}, {
word: "THROWER",
words: ["THROW"]
}, {
word: "CATCHER",
words: ["CATCH"]
}, {
word: "PUSHER",
words: ["PUSH"]
}, {
word: "PULLER",
words: ["PULL"]
}, {
word: "HOLDER",
words: ["HOLD"]
}, {
word: "LIFTER",
words: ["LIFT"]
}, {
word: "MOVER",
words: ["MOVE"]
}, {
word: "SHAKER",
words: ["SHAKE"]
}, {
word: "MAKER",
words: ["MAKE"]
}];
// Extend medium levels to 300 levels
var mediumWords = ["BASKET", "CASTLE", "DANGER", "ELEVEN", "FROZEN", "GROUND", "HEIGHT", "INVITE", "JACKET", "KITCHEN", "LADDER", "MOTHER", "NUMBER", "OBJECT", "PEOPLE", "QUEENS", "RESULT", "SWITCH", "TEMPLE", "UNITED", "VICTOR", "WONDER", "XAVIER", "YELLOW", "ZIPPER", "ANCHOR", "BUTTER", "CORNER", "DOUBLE", "ENERGY", "FINGER", "GOLDEN", "HEALTH", "ISLAND", "JUNGLE", "KNIGHT", "LEGEND", "MONKEY", "NEPHEW", "OYSTER", "PRETTY", "QUARTER", "RESCUE", "SIMPLE", "TURKEY", "URGENT", "VELVET", "WINTER", "XENIAL", "YOGURT"];
for (var i = 51; i < mediumWords.length && i < 300; i++) {
var word = mediumWords[i - 51];
var subword = word.substring(0, 3);
englishMediumLevels.push({
word: word,
words: [subword]
});
}
// Fill remaining slots
for (var i = 0; i < 300; i++) {
var levelData = englishMediumLevels[i % englishMediumLevels.length];
var alternatives = getWordAlternatives(levelData.word);
englishWordLists.push({
word: levelData.word,
words: levelData.words.slice(),
alternatives: alternatives
});
}
// HARD LEVELS (601-900): Main word + 2-4 sub-words
var englishHardLevels = [{
word: "STREAM",
words: ["TEAM", "STEAM", "MASTER"]
}, {
word: "PLAYER",
words: ["PLAY", "LAYER", "REPLAY"]
}, {
word: "GARDEN",
words: ["GRADE", "RANGE", "DANGER"]
}, {
word: "MASTER",
words: ["STEAM", "TEAMS", "STREAM"]
}, {
word: "LISTEN",
words: ["SILENT", "ENLIST", "TINSEL"]
}, {
word: "WONDER",
words: ["DRONE", "OWNER", "DROWN"]
}, {
word: "FRIEND",
words: ["FINDER", "FIRE", "RIDE"]
}, {
word: "MOTHER",
words: ["OTHER", "METRO", "THERMO"]
}, {
word: "FATHER",
words: ["HATER", "HEART", "EARTH"]
}, {
word: "SISTER",
words: ["RESIST", "TREES", "STEER"]
}, {
word: "BROTHER",
words: ["OTHER", "BERTH", "BOTHER"]
}, {
word: "TEACHER",
words: ["CHEATER", "CREATE", "THEATER"]
}, {
word: "STUDENT",
words: ["STUNNED", "DENTS", "TUNED"]
}, {
word: "PAINTER",
words: ["REPAINT", "PARENT", "RETINA"]
}, {
word: "WRITER",
words: ["REWRITE", "TIRE", "WIRE"]
}, {
word: "READER",
words: ["REREAD", "DEAR", "RARE"]
}, {
word: "DRIVER",
words: ["REDRIVE", "RIDE", "RIVER"]
}, {
word: "SINGER",
words: ["RESIGN", "RINGS", "REIGN"]
}, {
word: "DANCER",
words: ["RACED", "CRANE", "NECTAR"]
}, {
word: "WORKER",
words: ["REWORK", "WORK", "WORE"]
}, {
word: "HELPER",
words: ["HELP", "RELPH", "HEEL"]
}, {
word: "LEADER",
words: ["DEALER", "REAL", "LEAD"]
}, {
word: "FINDER",
words: ["FRIEND", "FIND", "FIRE"]
}, {
word: "KEEPER",
words: ["PEEK", "KEEP", "PEER"]
}, {
word: "LOSER",
words: ["ROLES", "LOSE", "SOLE"]
}, {
word: "WINNER",
words: ["INNER", "WIN", "WIRE"]
}, {
word: "RUNNER",
words: ["RUN", "RUNE", "RUER"]
}, {
word: "WALKER",
words: ["WALK", "AWKE", "REAL"]
}, {
word: "TALKER",
words: ["TALK", "REAL", "LATE"]
}, {
word: "THINKER",
words: ["THINK", "INERT", "THEIR"]
}, {
word: "DREAMER",
words: ["DREAM", "REARM", "DERMA"]
}, {
word: "SLEEPER",
words: ["SLEEP", "SPEEL", "PEERS"]
}, {
word: "WATCHER",
words: ["WATCH", "CHEAT", "CRATE"]
}, {
word: "LISTENER",
words: ["LISTEN", "SILENT", "ENLIST"]
}, {
word: "SPEAKER",
words: ["SPEAK", "PEAKS", "SEPAR"]
}, {
word: "CREATOR",
words: ["CREATE", "ACTOR", "TRACER"]
}, {
word: "BUILDER",
words: ["BUILD", "BRIDE", "RULED"]
}, {
word: "FIGHTER",
words: ["FIGHT", "EIGHT", "TIGER"]
}, {
word: "CLIMBER",
words: ["CLIMB", "CRIME", "LIMBER"]
}, {
word: "SWIMMER",
words: ["SWIM", "WIRES", "SWIMS"]
}, {
word: "JUMPER",
words: ["JUMP", "RUMP", "PURE"]
}, {
word: "THROWER",
words: ["THROW", "OTHER", "WHERE"]
}, {
word: "CATCHER",
words: ["CATCH", "CHEAT", "REACH"]
}, {
word: "PUSHER",
words: ["PUSH", "HUES", "SURE"]
}, {
word: "PULLER",
words: ["PULL", "RULE", "LURE"]
}, {
word: "HOLDER",
words: ["HOLD", "RODE", "ROLE"]
}, {
word: "LIFTER",
words: ["LIFT", "TILE", "FELT"]
}, {
word: "MOVER",
words: ["MOVE", "OVER", "ROME"]
}, {
word: "SHAKER",
words: ["SHAKE", "HEARS", "SHARE"]
}, {
word: "MAKER",
words: ["MAKE", "REAM", "MARE"]
}, {
word: "TAKER",
words: ["TAKE", "RATE", "TEAR"]
}, {
word: "GIVER",
words: ["GIVE", "RIVE", "VERI"]
}, {
word: "LOVER",
words: ["LOVE", "OVER", "ROLE"]
}];
// Extend to 300 hard levels
for (var i = 0; i < 300; i++) {
var levelData = englishHardLevels[i % englishHardLevels.length];
var alternatives = getWordAlternatives(levelData.word);
englishWordLists.push({
word: levelData.word,
words: levelData.words.slice(),
alternatives: alternatives
});
}
// EXPERT LEVELS (901-1000): Main word + 3-5 sub-words - most challenging
var englishExpertLevels = [{
word: "STREAM",
words: ["TEAM", "STEAM", "MASTER", "STREAM"]
}, {
word: "PLAYER",
words: ["PLAY", "LAYER", "REPLAY", "PARLEY"]
}, {
word: "GARDEN",
words: ["GRADE", "RANGE", "DANGER", "RANGED"]
}, {
word: "MASTER",
words: ["STEAM", "TEAMS", "STREAM", "TAMERS"]
}, {
word: "LISTEN",
words: ["SILENT", "ENLIST", "TINSEL", "INLETS"]
}, {
word: "WONDER",
words: ["DRONE", "OWNER", "DROWN", "WONDER"]
}, {
word: "FRIEND",
words: ["FINDER", "FIRE", "RIDE", "FRIED"]
}, {
word: "MOTHER",
words: ["OTHER", "METRO", "THERMO", "MOTHER"]
}, {
word: "FATHER",
words: ["HATER", "HEART", "EARTH", "FATHER"]
}, {
word: "SISTER",
words: ["RESIST", "TREES", "STEER", "SISTER"]
}, {
word: "BROTHER",
words: ["OTHER", "BERTH", "BOTHER", "BROTHER"]
}, {
word: "TEACHER",
words: ["CHEATER", "CREATE", "THEATER", "TEACHER"]
}, {
word: "STUDENT",
words: ["STUNNED", "DENTS", "TUNED", "STUDENT"]
}, {
word: "PAINTER",
words: ["REPAINT", "PARENT", "RETINA", "PAINTER"]
}, {
word: "WRITER",
words: ["REWRITE", "TIRE", "WIRE", "WRITER"]
}, {
word: "READER",
words: ["REREAD", "DEAR", "RARE", "READER"]
}, {
word: "DRIVER",
words: ["REDRIVE", "RIDE", "RIVER", "DRIVER"]
}, {
word: "SINGER",
words: ["RESIGN", "RINGS", "REIGN", "SINGER"]
}, {
word: "DANCER",
words: ["RACED", "CRANE", "NECTAR", "DANCER"]
}, {
word: "WORKER",
words: ["REWORK", "WORK", "WORE", "WORKER"]
}, {
word: "HELPER",
words: ["HELP", "RELPH", "HEEL", "HELPER"]
}, {
word: "LEADER",
words: ["DEALER", "REAL", "LEAD", "LEADER"]
}, {
word: "FINDER",
words: ["FRIEND", "FIND", "FIRE", "FINDER"]
}, {
word: "KEEPER",
words: ["PEEK", "KEEP", "PEER", "KEEPER"]
}, {
word: "LOSER",
words: ["ROLES", "LOSE", "SOLE", "LOSER"]
}, {
word: "WINNER",
words: ["INNER", "WIN", "WIRE", "WINNER"]
}, {
word: "RUNNER",
words: ["RUN", "RUNE", "RUER", "RUNNER"]
}, {
word: "WALKER",
words: ["WALK", "AWKE", "REAL", "WALKER"]
}, {
word: "TALKER",
words: ["TALK", "REAL", "LATE", "TALKER"]
}, {
word: "THINKER",
words: ["THINK", "INERT", "THEIR", "THINKER"]
}, {
word: "DREAMER",
words: ["DREAM", "REARM", "DERMA", "DREAMER"]
}, {
word: "SLEEPER",
words: ["SLEEP", "SPEEL", "PEERS", "SLEEPER"]
}, {
word: "WATCHER",
words: ["WATCH", "CHEAT", "CRATE", "WATCHER"]
}, {
word: "LISTENER",
words: ["LISTEN", "SILENT", "ENLIST", "LISTENER"]
}, {
word: "SPEAKER",
words: ["SPEAK", "PEAKS", "SEPAR", "SPEAKER"]
}, {
word: "CREATOR",
words: ["CREATE", "ACTOR", "TRACER", "CREATOR"]
}, {
word: "BUILDER",
words: ["BUILD", "BRIDE", "RULED", "BUILDER"]
}, {
word: "FIGHTER",
words: ["FIGHT", "EIGHT", "TIGER", "FIGHTER"]
}, {
word: "CLIMBER",
words: ["CLIMB", "CRIME", "LIMBER", "CLIMBER"]
}, {
word: "SWIMMER",
words: ["SWIM", "WIRES", "SWIMS", "SWIMMER"]
}, {
word: "JUMPER",
words: ["JUMP", "RUMP", "PURE", "JUMPER"]
}, {
word: "THROWER",
words: ["THROW", "OTHER", "WHERE", "THROWER"]
}, {
word: "CATCHER",
words: ["CATCH", "CHEAT", "REACH", "CATCHER"]
}, {
word: "PUSHER",
words: ["PUSH", "HUES", "SURE", "PUSHER"]
}, {
word: "PULLER",
words: ["PULL", "RULE", "LURE", "PULLER"]
}, {
word: "HOLDER",
words: ["HOLD", "RODE", "ROLE", "HOLDER"]
}, {
word: "LIFTER",
words: ["LIFT", "TILE", "FELT", "LIFTER"]
}, {
word: "MOVER",
words: ["MOVE", "OVER", "ROME", "MOVER"]
}, {
word: "SHAKER",
words: ["SHAKE", "HEARS", "SHARE", "SHAKER"]
}, {
word: "MAKER",
words: ["MAKE", "REAM", "MARE", "MAKER"]
}, {
word: "TAKER",
words: ["TAKE", "RATE", "TEAR", "TAKER"]
}, {
word: "GIVER",
words: ["GIVE", "RIVE", "VERI", "GIVER"]
}, {
word: "LOVER",
words: ["LOVE", "OVER", "ROLE", "LOVER"]
}];
// Extend to 100 expert levels
for (var i = 0; i < 100; i++) {
var levelData = englishExpertLevels[i % englishExpertLevels.length];
var alternatives = getWordAlternatives(levelData.word);
englishWordLists.push({
word: levelData.word,
words: levelData.words.slice(),
alternatives: alternatives
});
}
// Language switching function
function setLanguage(language) {
currentLanguage = language;
storage.currentLanguage = language;
if (language === 'turkish') {
wordLists = turkishWordLists;
} else {
wordLists = englishWordLists;
}
// Reset game to level 1 when switching languages
currentLevel = 0;
storage.currentLevel = 0;
currentWordData = wordLists[currentLevel % wordLists.length];
// Update all UI texts
updateAllUITexts();
}
// Function to update all UI texts based on current language
function updateAllUITexts() {
// Menu texts
titleText.setText(getString('title'));
menuCoinsText.setText(getString('money') + ': ' + coins);
menuLevelText.setText(getString('level') + ': ' + (currentLevel + 1));
// Buy hint menu texts
buyHintTitleText.setText(getString('buyHint'));
buyHintInfoText.setText(getString('oneHint'));
buyHintCoinsText.setText(getString('yourMoney') + ': ' + coins);
// Game UI texts
levelText.setText(getString('level') + ' ' + (currentLevel + 1));
coinsText.setText(getString('money') + ': ' + coins);
scoreText.setText(getString('score') + ': ' + totalScore);
hintText.setText(getString('hintText') + hintCount);
}
// Set initial language to English
wordLists = englishWordLists;
// Game state
var gameState = 'menu'; // 'menu', 'playing', 'buying'
var currentLevel = storage.currentLevel || 0;
var totalScore = storage.totalScore || 0;
var coins = storage.coins || 0;
var hintCount = storage.hintCount || 2;
var currentWordData = wordLists[currentLevel % wordLists.length];
var foundWords = [];
var selectedLetters = [];
var currentWord = "";
var letterTiles = [];
var foundWordItems = [];
var musicVolume = storage.musicVolume || 0.5;
// Main Menu Elements
var menuContainer = new Container();
game.addChild(menuContainer);
var titleText = new Text2('WORD GAME', {
size: 80,
fill: 0x2196F3
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 800;
menuContainer.addChild(titleText);
var startButton = menuContainer.addChild(LK.getAsset('startButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
var menuCoinsText = new Text2('COINS: ' + coins, {
size: 42,
fill: 0xFFD700
});
menuCoinsText.anchor.set(0.5, 0.5);
menuCoinsText.x = 1024;
menuCoinsText.y = 1000;
menuContainer.addChild(menuCoinsText);
var menuLevelText = new Text2('LEVEL: ' + (currentLevel + 1), {
size: 36,
fill: 0x666666
});
menuLevelText.anchor.set(0.5, 0.5);
menuLevelText.x = 1024;
menuLevelText.y = 1400;
menuContainer.addChild(menuLevelText);
// About button
var aboutButton = menuContainer.addChild(LK.getAsset('aboutButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 824,
y: 1550,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
aboutButton.down = function () {
showAboutMenu();
LK.getSound('buttonClick').play();
};
// Settings button
var settingsButton = menuContainer.addChild(LK.getAsset('settingsButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1224,
y: 1550,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
settingsButton.down = function () {
showSettingsMenu();
LK.getSound('buttonClick').play();
};
startButton.down = function () {
startGame();
initializeLetterTiles();
LK.getSound('buttonClick').play();
};
// Settings Menu Elements
var settingsContainer = new Container();
settingsContainer.visible = false;
game.addChild(settingsContainer);
var settingsTitleText = new Text2('SETTINGS', {
size: 60,
fill: 0x2196F3
});
settingsTitleText.anchor.set(0.5, 0.5);
settingsTitleText.x = 1024;
settingsTitleText.y = 600;
settingsContainer.addChild(settingsTitleText);
var musicVolumeText = new Text2('MUSIC VOLUME: ' + Math.round(musicVolume * 100) + '%', {
size: 42,
fill: 0x666666
});
musicVolumeText.anchor.set(0.5, 0.5);
musicVolumeText.x = 1024;
musicVolumeText.y = 800;
settingsContainer.addChild(musicVolumeText);
// Volume control buttons
var volumeDownButton = settingsContainer.addChild(LK.getAsset('volumeDownButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 724,
y: 900,
scaleX: 1.0,
scaleY: 1.0
}));
// Text already included in image asset - no overlay needed
var volumeUpButton = settingsContainer.addChild(LK.getAsset('volumeUpButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1324,
y: 900,
scaleX: 1.0,
scaleY: 1.0
}));
// Text already included in image asset - no overlay needed
var backFromSettingsButton = settingsContainer.addChild(LK.getAsset('backButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
// Volume control handlers
volumeDownButton.down = function () {
var oldVolume = musicVolume;
musicVolume = Math.max(0, musicVolume - 0.1);
storage.musicVolume = musicVolume;
musicVolumeText.setText('MUSIC VOLUME: ' + Math.round(musicVolume * 100) + '%');
LK.playMusic('backgroundMusic', {
volume: musicVolume
});
LK.getSound('buttonClick').play();
};
volumeUpButton.down = function () {
var oldVolume = musicVolume;
musicVolume = Math.min(1, musicVolume + 0.1);
storage.musicVolume = musicVolume;
musicVolumeText.setText('MUSIC VOLUME: ' + Math.round(musicVolume * 100) + '%');
LK.playMusic('backgroundMusic', {
volume: musicVolume
});
LK.getSound('buttonClick').play();
};
backFromSettingsButton.down = function () {
showSettingsMenu(false);
};
// About Menu Elements
var aboutContainer = new Container();
aboutContainer.visible = false;
game.addChild(aboutContainer);
var aboutTitleText = new Text2('HOW TO PLAY', {
size: 60,
fill: 0x2196F3
});
aboutTitleText.anchor.set(0.5, 0.5);
aboutTitleText.x = 1024;
aboutTitleText.y = 400;
aboutContainer.addChild(aboutTitleText);
var aboutText = new Text2('WORD PUZZLE GAME - 1000 LEVELS\n\nHOW TO PLAY:\n• Letters are arranged in a circular pattern\n• Drag from one letter to another to form words\n• Find all possible words to complete each level\n• Each word earns you 5 coins\n• Use hints when stuck (costs 50 coins)\n\nDIFFICULTY PROGRESSION:\n• Levels 1-300: EASY - Find the main word only\n• Levels 301-600: MEDIUM - Find main word + 1-2 sub-words\n• Levels 601-900: HARD - Find main word + 2-4 sub-words\n• Levels 901-1000: EXPERT - Find main word + 3-5 sub-words\n\nFEATURES:\n• Circular letter selection like phone pattern\n• Background music with volume control\n• Futuristic backgrounds every 50 levels\n• Bonus hints at certain milestones\n• Complete all 1000 levels to become a word master!', {
size: 28,
fill: 0x666666
});
aboutText.anchor.set(0.5, 0.5);
aboutText.x = 1024;
aboutText.y = 800;
aboutContainer.addChild(aboutText);
var backFromAboutButton = aboutContainer.addChild(LK.getAsset('backButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
backFromAboutButton.down = function () {
showAboutMenu(false);
};
// Buy Hint Menu Elements
var buyHintContainer = new Container();
buyHintContainer.visible = false;
game.addChild(buyHintContainer);
var buyHintTitleText = new Text2('BUY HINT', {
size: 60,
fill: 0xFF9800
});
buyHintTitleText.anchor.set(0.5, 0.5);
buyHintTitleText.x = 1024;
buyHintTitleText.y = 800;
buyHintContainer.addChild(buyHintTitleText);
var buyHintInfoText = new Text2('1 HINT = 50 COINS', {
size: 42,
fill: 0x666666
});
buyHintInfoText.anchor.set(0.5, 0.5);
buyHintInfoText.x = 1024;
buyHintInfoText.y = 1000;
buyHintContainer.addChild(buyHintInfoText);
var buyHintCoinsText = new Text2('YOUR COINS: ' + coins, {
size: 36,
fill: 0xFFD700
});
buyHintCoinsText.anchor.set(0.5, 0.5);
buyHintCoinsText.x = 1024;
buyHintCoinsText.y = 1100;
buyHintContainer.addChild(buyHintCoinsText);
var buyHintButton = buyHintContainer.addChild(LK.getAsset('buyHintButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 824,
y: 1300,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
var backFromBuyButton = buyHintContainer.addChild(LK.getAsset('backButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1224,
y: 1300,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
buyHintButton.down = function () {
buyHint();
};
backFromBuyButton.down = function () {
showBuyHintMenu(false);
};
// Game UI Container
var gameContainer = new Container();
gameContainer.visible = false;
game.addChild(gameContainer);
// UI Elements - Scaled for full screen
var levelText = new Text2('LEVEL ' + (currentLevel + 1), {
size: 54,
fill: 0x333333
});
levelText.anchor.set(0.5, 0);
levelText.x = 1024;
levelText.y = 150;
gameContainer.addChild(levelText);
var currentWordDisplay = new Text2('', {
size: 48,
fill: 0x666666
});
currentWordDisplay.anchor.set(0.5, 0.5);
currentWordDisplay.x = 1024;
currentWordDisplay.y = 650;
gameContainer.addChild(currentWordDisplay);
var coinsText = new Text2('COINS: ' + coins, {
size: 36,
fill: 0xFFD700
});
coinsText.anchor.set(1, 0);
coinsText.x = 2000;
coinsText.y = 50;
gameContainer.addChild(coinsText);
var scoreText = new Text2('SCORE: ' + totalScore, {
size: 42,
fill: 0x333333
});
scoreText.anchor.set(1, 0);
scoreText.x = 2000;
scoreText.y = 100;
gameContainer.addChild(scoreText);
var hintText = new Text2('HINTS: ' + hintCount, {
size: 36,
fill: 0xFF9800
});
hintText.anchor.set(0, 0);
hintText.x = 150;
hintText.y = 50;
gameContainer.addChild(hintText);
// Progress bar - Larger and repositioned
var progressBg = gameContainer.addChild(LK.getAsset('progressBg', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 250,
scaleX: 2,
scaleY: 1.5
}));
var progressFill = gameContainer.addChild(LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
x: 624,
y: 250,
scaleX: 0,
scaleY: 1.5
}));
// Submit button - Larger
var submitButton = gameContainer.addChild(LK.getAsset('submitButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 750,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
submitButton.down = function (x, y, obj) {
submitWord();
};
// Clear button - Larger and repositioned
var clearButton = gameContainer.addChild(LK.getAsset('clearButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 624,
y: 750,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
clearButton.down = function (x, y, obj) {
clearSelection();
};
// Hint button - Larger and repositioned
var hintButton = gameContainer.addChild(LK.getAsset('hintButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1424,
y: 750,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
hintButton.down = function (x, y, obj) {
useHint();
};
// Buy Hint button
var buyHintGameButton = gameContainer.addChild(LK.getAsset('buyHintButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1724,
y: 750,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
buyHintGameButton.down = function () {
showBuyHintMenu(true);
};
// Back to menu button
var backToMenuButton = gameContainer.addChild(LK.getAsset('backToMenuButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 324,
y: 750,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
backToMenuButton.down = function () {
backToMenu();
};
// Sequence input display container - Shows selected letters in order
var sequenceContainer = new Container();
sequenceContainer.x = 1024;
sequenceContainer.y = 400;
gameContainer.addChild(sequenceContainer);
// Found words container - Repositioned for full screen
var foundWordsContainer = new Container();
foundWordsContainer.x = 100;
foundWordsContainer.y = 900;
gameContainer.addChild(foundWordsContainer);
// Level completion popup container
var levelCompleteContainer = new Container();
levelCompleteContainer.visible = false;
game.addChild(levelCompleteContainer);
// Semi-transparent background overlay
var levelCompleteOverlay = levelCompleteContainer.addChild(LK.getAsset('futuristicBg2', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 1.0,
scaleY: 1.0
}));
levelCompleteOverlay.alpha = 0.8;
// Level passed text
var levelPassedText = new Text2('LEVEL PASSED!', {
size: 72,
fill: 0x4CAF50
});
levelPassedText.anchor.set(0.5, 0.5);
levelPassedText.x = 1024;
levelPassedText.y = 1200;
levelCompleteContainer.addChild(levelPassedText);
// Next level button
var nextLevelButton = levelCompleteContainer.addChild(LK.getAsset('nextLevelButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1500,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
nextLevelButton.down = function () {
hideLevelCompletePopup();
loadNextLevel();
LK.getSound('buttonClick').play();
};
// Global variables for sequence display
var sequenceBoxes = [];
var maxSequenceLength = 12; // Maximum word length we expect
// Drag-based selection variables
var isDragging = false;
var dragStartTile = null;
var lastDraggedTile = null;
// Initialize sequence display boxes
function initializeSequenceDisplay() {
// Clear existing sequence boxes
for (var i = 0; i < sequenceBoxes.length; i++) {
sequenceBoxes[i].destroy();
}
sequenceBoxes = [];
var boxSpacing = 70;
var startX = -((maxSequenceLength - 1) * boxSpacing) / 2;
for (var i = 0; i < maxSequenceLength; i++) {
var box = new Container();
// Background box
var bg = box.attachAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.2
});
bg.alpha = 0.3;
// Letter text
var letterText = new Text2('', {
size: 40,
fill: 0x333333
});
letterText.anchor.set(0.5, 0.5);
box.addChild(letterText);
box.x = startX + i * boxSpacing;
box.letterText = letterText;
box.background = bg;
sequenceBoxes.push(box);
sequenceContainer.addChild(box);
}
}
// Update sequence display
function updateSequenceDisplay() {
for (var i = 0; i < sequenceBoxes.length; i++) {
var box = sequenceBoxes[i];
if (i < selectedLetters.length) {
var letter = selectedLetters[i].letter;
// Use proper alphabet casing
if (currentLanguage === 'turkish') {
letter = letter.toUpperCase();
} else {
letter = letter.toUpperCase();
}
box.letterText.setText(letter);
box.background.alpha = 1.0;
box.background.tint = 0x4CAF50;
} else {
box.letterText.setText('');
box.background.alpha = 0.3;
box.background.tint = 0xffffff;
}
}
}
// Initialize letter tiles
function initializeLetterTiles() {
// Clear existing tiles
for (var i = 0; i < letterTiles.length; i++) {
letterTiles[i].destroy();
}
letterTiles = [];
var letters = currentWordData.word.split('');
// Convert letters to proper alphabet
for (var i = 0; i < letters.length; i++) {
if (currentLanguage === 'turkish') {
letters[i] = letters[i].toUpperCase();
} else {
letters[i] = letters[i].toUpperCase();
}
}
// Shuffle the letters randomly
var shuffledLetters = [];
for (var i = 0; i < letters.length; i++) {
shuffledLetters.push(letters[i]);
}
// Fisher-Yates shuffle algorithm
for (var i = shuffledLetters.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = shuffledLetters[i];
shuffledLetters[i] = shuffledLetters[j];
shuffledLetters[j] = temp;
}
// Arrange letters in a circular pattern
var centerX = 1024;
var centerY = 1200;
var radius = 300;
for (var i = 0; i < shuffledLetters.length; i++) {
var tile = new LetterTile(shuffledLetters[i], i);
// Calculate circular position
var angle = i / shuffledLetters.length * 2 * Math.PI - Math.PI / 2; // Start from top
tile.x = centerX + Math.cos(angle) * radius;
tile.y = centerY + Math.sin(angle) * radius;
tile.scaleX = 1.5;
tile.scaleY = 1.5;
letterTiles.push(tile);
gameContainer.addChild(tile);
}
// Initialize sequence display
initializeSequenceDisplay();
}
// Update current word display
function updateCurrentWord() {
currentWord = '';
for (var i = 0; i < selectedLetters.length; i++) {
currentWord += selectedLetters[i].letter;
}
// Clear the display first, then set new text to prevent overlapping
currentWordDisplay.setText('');
currentWordDisplay.setText(currentWord.toUpperCase());
}
// Clear letter selection
function clearSelection() {
for (var i = 0; i < selectedLetters.length; i++) {
selectedLetters[i].setSelected(false);
}
selectedLetters = [];
currentWord = '';
// Clear display completely before setting empty text
currentWordDisplay.setText('');
currentWordDisplay.setText('');
updateSequenceDisplay();
LK.getSound('buttonClick').play();
}
// Submit word
function submitWord() {
if (currentWord.length < 3) {
LK.effects.flashObject(currentWordDisplay, 0xff0000, 500);
return;
}
var wordLower = currentWord.toLowerCase();
var isValidWord = false;
// Check if word exists in current level's word list OR is the main word itself
for (var i = 0; i < currentWordData.words.length; i++) {
if (currentWordData.words[i].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
// Also check if it's the main word itself
if (currentWordData.word.toLowerCase() === wordLower) {
isValidWord = true;
}
// Comprehensive alternative checking system
if (!isValidWord) {
// 1. Check if input word matches any alternative of the main word
var mainWordAlternatives = getWordAlternatives(currentWordData.word);
for (var i = 0; i < mainWordAlternatives.length; i++) {
if (mainWordAlternatives[i].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
// 2. Check if input word matches any alternative of sub-words
if (!isValidWord) {
for (var i = 0; i < currentWordData.words.length; i++) {
var subWordAlternatives = getWordAlternatives(currentWordData.words[i]);
for (var j = 0; j < subWordAlternatives.length; j++) {
if (subWordAlternatives[j].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
if (isValidWord) break;
}
}
// 3. Check if any alternative of input word matches main word
if (!isValidWord) {
var inputWordAlternatives = getWordAlternatives(currentWord);
for (var i = 0; i < inputWordAlternatives.length; i++) {
var altWord = inputWordAlternatives[i].toLowerCase();
if (currentWordData.word.toLowerCase() === altWord) {
isValidWord = true;
break;
}
}
}
// 4. Check if any alternative of input word matches any sub-word
if (!isValidWord) {
var inputWordAlternatives = getWordAlternatives(currentWord);
for (var i = 0; i < inputWordAlternatives.length; i++) {
var altWord = inputWordAlternatives[i].toLowerCase();
for (var j = 0; j < currentWordData.words.length; j++) {
if (currentWordData.words[j].toLowerCase() === altWord) {
isValidWord = true;
break;
}
}
if (isValidWord) break;
}
}
// 5. Check if any alternative of main word matches input word
if (!isValidWord) {
var mainWordAlternatives = getWordAlternatives(currentWordData.word);
for (var i = 0; i < mainWordAlternatives.length; i++) {
if (mainWordAlternatives[i].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
}
// 6. Check if any alternative of sub-words matches input word
if (!isValidWord) {
for (var i = 0; i < currentWordData.words.length; i++) {
var subWordAlternatives = getWordAlternatives(currentWordData.words[i]);
for (var j = 0; j < subWordAlternatives.length; j++) {
if (subWordAlternatives[j].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
if (isValidWord) break;
}
}
}
// Check if word already found
var alreadyFound = false;
for (var i = 0; i < foundWords.length; i++) {
if (foundWords[i].toLowerCase() === wordLower) {
alreadyFound = true;
break;
}
}
if (isValidWord && !alreadyFound) {
// Word found!
var points = currentWord.length * 10;
var coinReward = 5;
foundWords.push(currentWord);
totalScore += points;
coins += coinReward;
// Add word to found words display
var wordItem = new WordItem(currentWord, points);
wordItem.y = (foundWords.length - 1) * 90;
foundWordsContainer.addChild(wordItem);
// Update UI
scoreText.setText(getString('score') + ': ' + totalScore);
coinsText.setText(getString('money') + ': ' + coins);
storage.coins = coins;
LK.setScore(totalScore);
// Calculate total possible words (including main word)
var totalPossibleWords = currentWordData.words.length + 1;
// Update progress
var progress = foundWords.length / totalPossibleWords;
progressFill.scaleX = progress;
// Play sound and flash green
LK.getSound('wordFound').play();
LK.effects.flashObject(currentWordDisplay, 0x4CAF50, 500);
// Shake animation for correct word - move left and right for 2 seconds
var originalX = currentWordDisplay.x;
tween(currentWordDisplay, {
x: originalX - 20
}, {
duration: 100,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 20
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 15
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 15
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX
}, {
duration: 100
});
}
});
}
});
}
});
}
});
}
});
}
});
// Complete level logic based on difficulty progression every 300 levels
var shouldCompleteLevel = false;
if (currentLevel < 300) {
// Easy levels (1-300): complete when main word is found
shouldCompleteLevel = currentWordData.word.toLowerCase() === wordLower;
} else if (currentLevel < 600) {
// Medium levels (301-600): complete when ALL words are found (including main word)
shouldCompleteLevel = foundWords.length >= totalPossibleWords;
} else if (currentLevel < 900) {
// Hard levels (601-900): complete when ALL words are found (including main word)
shouldCompleteLevel = foundWords.length >= totalPossibleWords;
} else {
// Expert levels (901-1000): complete when ALL words are found (including main word)
shouldCompleteLevel = foundWords.length >= totalPossibleWords;
}
if (shouldCompleteLevel) {
completeLevel();
}
clearSelection();
} else if (alreadyFound) {
LK.effects.flashObject(currentWordDisplay, 0xFFEB3B, 500);
clearSelection();
} else {
// Wrong word - red flash and shake effect
LK.effects.flashObject(currentWordDisplay, 0xff0000, 500);
// Shake animation - move left and right for 2 seconds
var originalX = currentWordDisplay.x;
tween(currentWordDisplay, {
x: originalX - 30
}, {
duration: 100,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 30
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 20
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 20
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX
}, {
duration: 100
});
}
});
}
});
}
});
}
});
}
});
}
});
clearSelection();
}
}
// Use hint
function useHint() {
if (hintCount <= 0) {
LK.effects.flashObject(hintText, 0xff0000, 500);
return;
}
// Find an unfound word
var unfoundWords = [];
// Check all words in the level
for (var i = 0; i < currentWordData.words.length; i++) {
var word = currentWordData.words[i];
var found = false;
for (var j = 0; j < foundWords.length; j++) {
if (foundWords[j].toLowerCase() === word.toLowerCase()) {
found = true;
break;
}
}
if (!found) {
unfoundWords.push(word);
}
}
// Also check if main word is unfound
var mainWordFound = false;
for (var j = 0; j < foundWords.length; j++) {
if (foundWords[j].toLowerCase() === currentWordData.word.toLowerCase()) {
mainWordFound = true;
break;
}
}
if (!mainWordFound) {
unfoundWords.push(currentWordData.word);
}
if (unfoundWords.length > 0) {
var randomWord = unfoundWords[Math.floor(Math.random() * unfoundWords.length)];
// Clear current selection
clearSelection();
// Find the first letter of the word and select it
var targetLetter = randomWord.charAt(0).toUpperCase();
for (var i = 0; i < letterTiles.length; i++) {
var tile = letterTiles[i];
if (tile.letter.toUpperCase() === targetLetter && !tile.isSelected) {
selectedLetters.push(tile);
tile.setSelected(true);
updateCurrentWord();
updateSequenceDisplay();
break;
}
}
hintCount--;
hintText.setText(getString('hintText') + hintCount);
storage.hintCount = hintCount;
LK.getSound('buttonClick').play();
}
}
// Complete level
function completeLevel() {
currentLevel++;
// Check if game completed (1000 levels)
if (currentLevel >= 1000) {
// Show completion message
var completionText = new Text2(getString('completedAll'), {
size: 48,
fill: 0x4CAF50
});
completionText.anchor.set(0.5, 0.5);
completionText.x = 1024;
completionText.y = 1366;
game.addChild(completionText);
LK.showYouWin();
return;
}
// Change background every 50 levels and bonus hint
if (currentLevel % 50 === 0) {
hintCount++;
updateBackground();
var bonusText = new Text2(getString('bonusHint'), {
size: 54,
fill: 0x4CAF50
});
bonusText.anchor.set(0.5, 0.5);
bonusText.x = 1024;
bonusText.y = 2000;
bonusText.alpha = 0;
game.addChild(bonusText);
tween(bonusText, {
alpha: 1,
y: 1600
}, {
duration: 500
});
tween(bonusText, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
bonusText.destroy();
}
});
}
// Save progress
storage.currentLevel = currentLevel;
storage.totalScore = totalScore;
storage.hintCount = hintCount;
LK.getSound('levelComplete').play();
LK.effects.flashScreen(0x4CAF50, 1000);
// Show level completion popup
showLevelCompletePopup();
}
// Load next level
function loadNextLevel() {
currentWordData = wordLists[currentLevel % wordLists.length];
foundWords = [];
selectedLetters = [];
currentWord = '';
// Clear found words display
for (var i = 0; i < foundWordItems.length; i++) {
foundWordItems[i].destroy();
}
foundWordItems = [];
// Clear found words container
for (var i = foundWordsContainer.children.length - 1; i >= 0; i--) {
foundWordsContainer.children[i].destroy();
}
// Update UI
levelText.setText(getString('level') + ' ' + (currentLevel + 1));
// Clear display completely before setting empty text
currentWordDisplay.setText('');
currentWordDisplay.setText('');
hintText.setText(getString('hintText') + hintCount);
progressFill.scaleX = 0;
// Reinitialize letter tiles
initializeLetterTiles();
}
// Background management
var currentBackground = null;
function updateBackground() {
if (currentBackground) {
currentBackground.destroy();
}
var bgLevel = Math.floor(currentLevel / 50);
var bgAssetName = 'futuristicBg' + (bgLevel % 3 + 1);
currentBackground = game.addChildAt(LK.getAsset(bgAssetName, {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}), 0);
currentBackground.alpha = 0.3; // Semi-transparent so UI remains visible
}
function showAboutMenu(show) {
if (show === undefined) {
show = true;
}
if (show) {
gameState = 'about';
menuContainer.visible = false;
aboutContainer.visible = true;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = false;
} else {
gameState = 'menu';
menuContainer.visible = true;
aboutContainer.visible = false;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = false;
}
}
function showSettingsMenu(show) {
if (show === undefined) {
show = true;
}
if (show) {
gameState = 'settings';
menuContainer.visible = false;
aboutContainer.visible = false;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = true;
} else {
gameState = 'menu';
menuContainer.visible = true;
aboutContainer.visible = false;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = false;
}
}
// Game state management functions
function startGame() {
gameState = 'playing';
menuContainer.visible = false;
gameContainer.visible = true;
buyHintContainer.visible = false;
aboutContainer.visible = false;
settingsContainer.visible = false;
updateBackground(); // Set initial background
// Start background music
LK.playMusic('backgroundMusic', {
fade: {
start: 0,
end: musicVolume,
duration: 1000
}
});
// Update display texts
coinsText.setText(getString('money') + ': ' + coins);
scoreText.setText(getString('score') + ': ' + totalScore);
hintText.setText(getString('hintText') + hintCount);
levelText.setText(getString('level') + ' ' + (currentLevel + 1));
}
function backToMenu() {
gameState = 'menu';
menuContainer.visible = true;
gameContainer.visible = false;
buyHintContainer.visible = false;
aboutContainer.visible = false;
settingsContainer.visible = false;
// Update menu texts
menuCoinsText.setText(getString('money') + ': ' + coins);
menuLevelText.setText(getString('level') + ': ' + (currentLevel + 1));
// Save progress
storage.currentLevel = currentLevel;
storage.totalScore = totalScore;
storage.coins = coins;
storage.hintCount = hintCount;
}
function showLevelCompletePopup() {
levelCompleteContainer.visible = true;
// Add "NEXT LEVEL" text
var nextLevelText = new Text2('NEXT LEVEL', {
size: 48,
fill: 0x2196F3
});
nextLevelText.anchor.set(0.5, 0.5);
nextLevelText.x = 1024;
nextLevelText.y = 1400;
levelCompleteContainer.addChild(nextLevelText);
// Animate the popup appearing
levelCompleteContainer.alpha = 0;
levelCompleteContainer.scaleX = 0.5;
levelCompleteContainer.scaleY = 0.5;
tween(levelCompleteContainer, {
alpha: 1,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 500,
easing: tween.easeOut
});
}
function hideLevelCompletePopup() {
tween(levelCompleteContainer, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
levelCompleteContainer.visible = false;
}
});
}
function showBuyHintMenu(show) {
if (show) {
gameState = 'buying';
gameContainer.visible = false;
buyHintContainer.visible = true;
buyHintCoinsText.setText(getString('yourMoney') + ': ' + coins);
} else {
gameState = 'playing';
gameContainer.visible = true;
buyHintContainer.visible = false;
}
}
function buyHint() {
if (coins >= 50) {
coins -= 50;
hintCount++;
storage.coins = coins;
storage.hintCount = hintCount;
// Update displays
buyHintCoinsText.setText(getString('yourMoney') + ': ' + coins);
coinsText.setText(getString('money') + ': ' + coins);
hintText.setText(getString('hintText') + hintCount);
LK.effects.flashObject(buyHintCoinsText, 0x4CAF50, 500);
LK.getSound('buttonClick').play();
} else {
LK.effects.flashObject(buyHintCoinsText, 0xff0000, 500);
}
}
// Initialize first level only if playing
if (gameState === 'playing') {
initializeLetterTiles();
} else {
// Show main menu by default
menuContainer.visible = true;
gameContainer.visible = false;
buyHintContainer.visible = false;
}
// Global mouse/touch handlers for drag-based selection
game.move = function (x, y, obj) {
if (gameState === 'playing' && isDragging) {
// Check if we're over any letter tile
for (var i = 0; i < letterTiles.length; i++) {
var tile = letterTiles[i];
var tileGlobalPos = tile.parent.toGlobal(tile.position);
var gamePos = game.toLocal(tileGlobalPos);
// Check if cursor/touch is over this tile (approximate collision detection)
var distance = Math.sqrt(Math.pow(x - gamePos.x, 2) + Math.pow(y - gamePos.y, 2));
if (distance < 60 && tile !== lastDraggedTile) {
// 60 is approximate tile radius
// Add this letter to selection if not already selected
var alreadySelected = false;
for (var j = 0; j < selectedLetters.length; j++) {
if (selectedLetters[j] === tile) {
alreadySelected = true;
break;
}
}
if (!alreadySelected) {
selectedLetters.push(tile);
tile.setSelected(true);
lastDraggedTile = tile;
updateCurrentWord();
updateSequenceDisplay();
}
break;
}
}
}
};
game.up = function (x, y, obj) {
if (gameState === 'playing' && isDragging) {
// End drag selection and automatically submit word
isDragging = false;
dragStartTile = null;
lastDraggedTile = null;
// Auto-submit the formed word if it has at least 3 letters
if (selectedLetters.length >= 3) {
submitWord();
} else {
// Clear selection if word is too short
clearSelection();
}
}
};
game.update = function () {
// Only run game logic when playing
if (gameState === 'playing') {
// Game runs continuously
}
}; /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var LetterTile = Container.expand(function (letter, index) {
var self = Container.call(this);
var background = self.attachAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5
});
var letterText = new Text2(letter.toUpperCase(), {
size: 50,
fill: 0x333333
});
letterText.anchor.set(0.5, 0.5);
self.addChild(letterText);
self.letter = letter;
self.index = index;
self.isSelected = false;
self.background = background;
self.letterText = letterText;
self.setSelected = function (selected) {
self.isSelected = selected;
if (selected) {
self.background.tint = 0x4CAF50;
// Add glow effect for selected tiles
self.background.scaleX = 1.1;
self.background.scaleY = 1.1;
} else {
self.background.tint = 0xffffff;
self.background.scaleX = 1.0;
self.background.scaleY = 1.0;
}
};
self.down = function (x, y, obj) {
if (gameState === 'playing') {
// Start drag selection
isDragging = true;
dragStartTile = self;
lastDraggedTile = self;
// Clear previous selection
for (var i = 0; i < selectedLetters.length; i++) {
selectedLetters[i].setSelected(false);
}
selectedLetters = [];
// Add this letter as the first in sequence
selectedLetters.push(self);
self.setSelected(true);
updateCurrentWord();
updateSequenceDisplay();
LK.getSound('buttonClick').play();
}
};
// Add move handler for drag selection
self.move = function (x, y, obj) {
if (gameState === 'playing' && isDragging && self !== lastDraggedTile) {
// Add this letter to selection if not already selected
var alreadySelected = false;
for (var i = 0; i < selectedLetters.length; i++) {
if (selectedLetters[i] === self) {
alreadySelected = true;
break;
}
}
if (!alreadySelected) {
selectedLetters.push(self);
self.setSelected(true);
lastDraggedTile = self;
updateCurrentWord();
updateSequenceDisplay();
}
}
};
// Add up handler to detect when dragging over this tile
self.up = function (x, y, obj) {
if (gameState === 'playing' && isDragging) {
// This will be handled by the game's global up handler
}
};
return self;
});
var WordItem = Container.expand(function (word, points) {
var self = Container.call(this);
var background = self.attachAsset('wordBackground', {
anchorX: 0,
anchorY: 0.5
});
background.alpha = 0.8;
var wordText = new Text2(word.toUpperCase(), {
size: 36,
fill: 0x333333
});
wordText.anchor.set(0, 0.5);
wordText.x = 15;
self.addChild(wordText);
var pointText = new Text2('+' + points, {
size: 30,
fill: 0x4CAF50
});
pointText.anchor.set(1, 0.5);
pointText.x = 580;
self.addChild(pointText);
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0xffffff
});
/****
* Game Code
****/
// Game data and word lists - 1000 levels total with difficulty progression every 300 levels
// Background assets for futuristic themes every 50 levels
var _wordAlternatives;
function _typeof2(o) {
"@babel/helpers - typeof";
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof2(o);
}
function _defineProperty2(e, r, t) {
return (r = _toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _toPropertyKey2(t) {
var i = _toPrimitive2(t, "string");
return "symbol" == _typeof2(i) ? i : i + "";
}
function _toPrimitive2(t, r) {
if ("object" != _typeof2(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof2(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _defineProperty(e, r, t) {
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[r] = t, e;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var currentLanguage = 'english';
var turkishWordLists = [];
var englishWordLists = [];
var wordLists = [];
// Language strings
var languageStrings = {
turkish: {
title: 'KELİME OYUNU',
start: 'BAŞLAT',
money: 'PARA',
level: 'SEVİYE',
languageSelection: 'DİL SEÇİMİ:',
buyHint: 'İPUCU SATIN AL',
oneHint: '1 İPUCU = 50 PARA',
yourMoney: 'PARAN',
buy: 'SATIN AL',
back: 'GERİ',
send: 'GÖNDER',
clear: 'TEMİZLE',
hint: 'İPUCU',
buyHintShort: 'İPUCU\nAL',
menu: 'MENÜ',
score: 'SKOR',
hintText: 'İPUCU: ',
completedAll: 'TEBRİKLER! TÜM SEVİYELERİ TAMAMLADINIZ!',
bonusHint: '+1 İPUCU BONUS!'
},
english: {
title: 'WORD GAME',
start: 'START',
money: 'COINS',
level: 'LEVEL',
languageSelection: 'LANGUAGE:',
buyHint: 'BUY HINT',
oneHint: '1 HINT = 50 COINS',
yourMoney: 'YOUR COINS',
buy: 'BUY',
back: 'BACK',
send: 'SUBMIT',
clear: 'CLEAR',
hint: 'HINT',
buyHintShort: 'BUY\nHINT',
menu: 'MENU',
score: 'SCORE',
hintText: 'HINTS: ',
completedAll: 'CONGRATULATIONS! ALL LEVELS COMPLETED!',
bonusHint: '+1 HINT BONUS!'
}
};
// Function to get localized string
function getString(key) {
return languageStrings[currentLanguage][key] || key;
}
// Alphabet definitions
var turkishAlphabet = 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ';
var englishAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
function getAlphabet() {
return currentLanguage === 'turkish' ? turkishAlphabet : englishAlphabet;
}
// EASY LEVELS (1-50): Only the main word can be found
var easyWords = ["KALEM", "KITAP", "OKUL", "MASA", "KEDI", "KOPEK", "ELMA", "ARMUT", "SEKER", "EKMEK", "GUNES", "YAGMUR", "KARLI", "SICAK", "SOGUK", "MUTLU", "UZGUN", "HIZLI", "YAVAS", "BUYUK", "KUCUK", "UZUN", "KISA", "GENIS", "DAR", "YENI", "ESKI", "GUZEL", "CIRKIN", "TEMIZ", "KIRLI", "BEYAZ", "SIYAH", "KIRMIZI", "MAVI", "YESIL", "SARI", "PEMBE", "MOR", "TURUNCU", "DOKTOR", "OGRETMEN", "POLIS", "ITFAIYE", "ASCI", "BERBER", "TERZI", "KAPICI", "GARSON", "SOFOR"];
for (var i = 0; i < 50; i++) {
turkishWordLists.push({
word: easyWords[i],
words: [],
alternatives: []
});
}
// MEDIUM LEVELS (51-100): Main word + 1 sub-word that can be made from the letters
var mediumLevels = [{
word: "PENCERE",
words: ["PEN"]
}, {
word: "TABLETU",
words: ["TAB"]
}, {
word: "KAHVALT",
words: ["KAH"]
}, {
word: "OKUYUCU",
words: ["OKU"]
}, {
word: "YAZILIM",
words: ["YAZ"]
}, {
word: "GELISIM",
words: ["GEL"]
}, {
word: "MUTLULUK",
words: ["MUT"]
}, {
word: "DOSTLUK",
words: ["DOS"]
}, {
word: "KARDESLIK",
words: ["KAR"]
}, {
word: "SEVGILIK",
words: ["SEV"]
}, {
word: "OYUNCAK",
words: ["OYN"]
}, {
word: "KITAPLIK",
words: ["KIT"]
}, {
word: "MASALAR",
words: ["MAS"]
}, {
word: "EVLERDE",
words: ["EV"]
}, {
word: "SEHIRLER",
words: ["SEH"]
}, {
word: "AILELER",
words: ["AIL"]
}, {
word: "ARKADAS",
words: ["ARK"]
}, {
word: "MERHABA",
words: ["MER"]
}, {
word: "GUNAYDIN",
words: ["GUN"]
}, {
word: "TESEKKUR",
words: ["TES"]
}, {
word: "HOSGELDIN",
words: ["HOS"]
}, {
word: "GORUSMEK",
words: ["GOR"]
}, {
word: "HABERLER",
words: ["HAB"]
}, {
word: "GELECEK",
words: ["GEL"]
}, {
word: "ZAMANLAR",
words: ["ZAM"]
}, {
word: "DUNYADA",
words: ["DUN"]
}, {
word: "HAYATTA",
words: ["HAY"]
}, {
word: "BILGILER",
words: ["BIL"]
}, {
word: "DERSLERI",
words: ["DER"]
}, {
word: "OGRETMEN",
words: ["OGR"]
}, {
word: "OKULLAR",
words: ["OKL"]
}, {
word: "EVIMIZDE",
words: ["EVI"]
}, {
word: "AILELERIMIZ",
words: ["AIL"]
}, {
word: "ARKADALAR",
words: ["ARK"]
}, {
word: "DOSTLUK",
words: ["DOS"]
}, {
word: "SEVGILIK",
words: ["SEV"]
}, {
word: "MUTLULUK",
words: ["MUT"]
}, {
word: "KAHVALTI",
words: ["KAH"]
}, {
word: "YEMEKLER",
words: ["YEM"]
}, {
word: "ICECEKLER",
words: ["ICE"]
}, {
word: "MEYVELER",
words: ["MEY"]
}, {
word: "SEBZELER",
words: ["SEB"]
}, {
word: "ETKINLIK",
words: ["ETK"]
}, {
word: "OYUNLAR",
words: ["OYN"]
}, {
word: "SPORCULAR",
words: ["SPO"]
}, {
word: "SANATCI",
words: ["SAN"]
}, {
word: "MUZISYEN",
words: ["MUZ"]
}, {
word: "RESSAMLAR",
words: ["RES"]
}, {
word: "YAZARLAR",
words: ["YAZ"]
}, {
word: "SAIRLER",
words: ["SAI"]
}, {
word: "FILMLER",
words: ["FIL"]
}, {
word: "DIZILER",
words: ["DIZ"]
}];
for (var i = 0; i < 50; i++) {
var levelData = mediumLevels[i];
levelData.alternatives = levelData.alternatives || [];
turkishWordLists.push(levelData);
}
// HARD LEVELS (101-150): Main word + 3 sub-words that can be made from the letters
var hardLevels = [{
word: "BILGISAYAR",
words: ["BIL", "GIS", "AYA"]
}, {
word: "TELEVIZYON",
words: ["TEL", "VIZ", "YON"]
}, {
word: "TELEFON",
words: ["TEL", "FON", "ELF"]
}, {
word: "INTERNET",
words: ["INT", "NET", "TER"]
}, {
word: "BILGILER",
words: ["BIL", "GIL", "LER"]
}, {
word: "PROGRAM",
words: ["PRO", "RAM", "GRA"]
}, {
word: "SISTEMI",
words: ["SIS", "TEM", "EMI"]
}, {
word: "TEKNOLOJI",
words: ["TEK", "NOL", "LOJ"]
}, {
word: "MATEMATIK",
words: ["MAT", "TEM", "TIK"]
}, {
word: "GEOMETRI",
words: ["GEO", "MET", "TRI"]
}, {
word: "COGRAFYA",
words: ["COG", "RAF", "YAF"]
}, {
word: "TARIH",
words: ["TAR", "IH", "HI"]
}, {
word: "EDEBIYAT",
words: ["EDE", "BIY", "YAT"]
}, {
word: "FIZIK",
words: ["FIZ", "ZIK", "IK"]
}, {
word: "KIMYA",
words: ["KIM", "MYA", "YA"]
}, {
word: "BIYOLOJI",
words: ["BIY", "OLO", "LOJ"]
}, {
word: "INGILIZCE",
words: ["ING", "LIZ", "ZCE"]
}, {
word: "FRANSIZCA",
words: ["FRA", "SIZ", "ZCA"]
}, {
word: "ALMANCA",
words: ["ALM", "MAN", "ANC"]
}, {
word: "TURKCE",
words: ["TUR", "KCE", "CE"]
}, {
word: "RESIM",
words: ["RES", "SIM", "IM"]
}, {
word: "MUZIK",
words: ["MUZ", "ZIK", "IK"]
}, {
word: "BEDEN",
words: ["BED", "DEN", "EN"]
}, {
word: "SAGLIK",
words: ["SAG", "LIK", "IK"]
}, {
word: "SPOR",
words: ["SPO", "OR", "R"]
}, {
word: "FUTBOL",
words: ["FUT", "BOL", "OL"]
}, {
word: "BASKETBOL",
words: ["BAS", "KET", "BOL"]
}, {
word: "VOLEYBOL",
words: ["VOL", "EY", "BOL"]
}, {
word: "TENIS",
words: ["TEN", "NIS", "IS"]
}, {
word: "YUZME",
words: ["YUZ", "ZME", "ME"]
}, {
word: "KOSU",
words: ["KOS", "OSU", "SU"]
}, {
word: "BISIKLET",
words: ["BIS", "IK", "LET"]
}, {
word: "OTOMOBIL",
words: ["OTO", "MOB", "BIL"]
}, {
word: "OTOBUS",
words: ["OTO", "BUS", "US"]
}, {
word: "TREN",
words: ["TR", "REN", "EN"]
}, {
word: "UCAK",
words: ["UC", "CAK", "AK"]
}, {
word: "GEMI",
words: ["GEM", "EMI", "MI"]
}, {
word: "BISIKLET",
words: ["BIS", "IK", "LET"]
}, {
word: "MOTOSIKLET",
words: ["MOT", "SIK", "LET"]
}, {
word: "TAKMISI",
words: ["TAK", "MIS", "SI"]
}, {
word: "OYUNCU",
words: ["OY", "YUN", "CU"]
}, {
word: "HAKEM",
words: ["HAK", "KEM", "EM"]
}, {
word: "ANTRENOR",
words: ["ANT", "REN", "NOR"]
}, {
word: "SAYGIN",
words: ["SAY", "YGI", "GIN"]
}, {
word: "BASARI",
words: ["BAS", "SAR", "ARI"]
}, {
word: "GALIBIYET",
words: ["GAL", "IBY", "YET"]
}, {
word: "MAGLUBIYE",
words: ["MAG", "LUB", "BIY"]
}, {
word: "BERABERE",
words: ["BER", "RAB", "ERE"]
}, {
word: "TAKIMLAR",
words: ["TAK", "KIM", "LAR"]
}, {
word: "TURNUVA",
words: ["TUR", "NUV", "VAL"]
}, {
word: "SAMPIYONLUK",
words: ["SAM", "PIY", "LUK"]
}];
for (var i = 0; i < 50; i++) {
var levelData = hardLevels[i];
levelData.alternatives = levelData.alternatives || [];
turkishWordLists.push(levelData);
}
// Generate 1000 English word levels with difficulty progression every 300 levels
// EASY LEVELS (1-300): Only the main word can be found - unique words only
var englishEasyWords = ["APPLE", "BREAD", "CHAIR", "DANCE", "EAGLE", "FIELD", "GRAPE", "HORSE", "ISLAND", "JUICE", "KNIFE", "LIGHT", "MAGIC", "NIGHT", "OCEAN", "PEACE", "QUEEN", "RIVER", "STONE", "TIGER", "UNITY", "VOICE", "WATER", "YOUTH", "ZEBRA", "BEACH", "CANDY", "DREAM", "EARTH", "FLAME", "GIANT", "HONEY", "IMAGE", "JEWEL", "KITE", "LEMON", "MOUSE", "NURSE", "OPERA", "PIANO", "QUIET", "ROBOT", "STORM", "TRAIN", "UNDER", "VALLEY", "WITCH", "XRAY", "YOUNG", "ZIGZAG", "BRIDGE", "CASTLE", "DESERT", "ENGINE", "FOREST", "GARDEN", "HAMMER", "INSECT", "JACKET", "KITTEN", "LADDER", "MARKET", "NEEDLE", "ORANGE", "PARROT", "RABBIT", "SILVER", "TURKEY", "UNCLE", "VIOLET", "WINDOW", "YELLOW", "BARREL", "CANDLE", "DOLPHIN", "EMPEROR", "FINGER", "GOLDEN", "HELMET", "IGLOO", "JUNGLE", "KERNEL", "LIZARD", "MIRROR", "NEPHEW", "OXYGEN", "PEPPER", "QUARTZ", "RAINBOW", "SHADOW", "TEMPLE", "UPWARD", "VELVET", "WIZARD", "XYLEM", "YOGURT", "ZEPHYR", "ARCTIC", "BUTTON", "CIRCLE", "DONKEY", "ELEVEN", "FROZEN", "GUITAR", "HUNTER", "INSANE", "JOYFUL", "KETTLE", "LEGEND", "MONKEY", "NEPHEW", "OFFICE", "POETRY", "QUIVER", "RIDDLE", "SIMPLE", "TIMBER", "UPSIDE", "VECTOR", "WISDOM", "XENIAL", "YONDER", "ZOMBIE", "BUCKET", "COUGAR", "DOLLAR", "EXPERT", "FOLDER", "GLOBAL", "HAMMER", "INDOOR", "JUNGLE", "KERNEL", "LINEAR", "MENTAL", "NORMAL", "ORIENT", "PENCIL", "QUORUM", "RENDER", "SPIRAL", "TOWARD", "UNBIND", "VISUAL", "WINTER", "XENON", "YODEL", "ZONAL", "ABRUPT", "BINARY", "CURSOR", "DEEPLY", "EXOTIC", "FORMAL", "GALAXY", "HYBRID", "IMPACT", "JUNIOR", "KINETIC", "LATERAL", "MANUAL", "NEURAL", "OXYGEN", "POLAR", "QUANTUM", "RANDOM", "STELLAR", "TREMOR", "UPWARD", "VERBAL", "WAIVER", "XERUS", "YEARLY", "ZENITH", "BLAZER", "CIPHER", "DYNAMO", "EQUINE", "FUSION", "GALAXY", "HERALD", "IMPACT", "JUMPER", "KNIGHT", "LINEAR", "MATRIX", "NEXUS", "ORIENT", "PRISM", "QUASAR", "RADIUS", "SECTOR", "TERROR", "UPLINK", "VECTOR", "WHISPER", "XENITH", "YOGIC", "ZIPPER", "BIONIC", "COSMIC", "DOMAIN", "ENIGMA", "FABRIC", "GADGET", "HARBOR", "INFLUX", "JIGSAW", "KERNEL", "LEGION", "MODERN", "NIMBUS", "ORIGIN", "PHOTON", "QUARRY", "REFORM", "SUMMIT", "TENSOR", "ULTIMA", "VERTEX", "WANDER", "XEBEC", "YELLOW", "ZYGOTE", "BEACON", "CHROME", "DEPLOY", "EVOLVE", "FACILE", "GENIUS", "HOLLOW", "INSURE", "JUNGLE", "KINSHIP", "LAUNCH", "MELODY", "NOTION", "OUTPUT", "PLEDGE", "QUARTZ", "RESCUE", "SYMBOL", "TENSOR", "UNIQUE", "VOYAGE", "WARMTH", "XENIAL", "YONDER", "ZODIAC", "BINARY", "COSMIC", "DEEPLY", "ENIGMA", "FABRIC", "GLOBAL", "HELMET", "INFLUX", "JUNGLE", "KINDLE", "LINEAR", "METEOR", "NEURAL", "OPTICS", "PLASMA", "QUORUM", "ROBUST", "SYSTEM", "TENSOR", "UNIQUE", "VECTOR", "WISDOM", "XENIAL", "YOGURT", "ZENITH", "BLAZER", "CIPHER", "DOMAIN", "EVOLVE", "FABRIC", "GOLDEN", "HOLDER", "IMPACT", "JUNGLE", "KERNEL", "LEGEND", "MATRIX", "NOTION", "ORIGIN", "PLASMA", "QUARRY", "RADIUS", "SPIRAL", "TIMBER", "UNIQUE", "VOYAGE", "WISDOM", "XENIAL", "YOGURT", "ZYGOTE"];
// Define word alternatives - words that can have multiple valid spellings
var wordAlternatives = (_wordAlternatives = {
// Common confusing spellings
"FIELD": ["FILED"],
"FILED": ["FIELD"],
"FRIEND": ["FREIND"],
"FREIND": ["FRIEND"],
"PIECE": ["PEICE"],
"PEICE": ["PIECE"],
"RECEIVE": ["RECIEVE"],
"RECIEVE": ["RECEIVE"],
"BELIEVE": ["BELEIVE"],
"BELEIVE": ["BELIEVE"],
"ACHIEVE": ["ACHEIVE"],
"ACHEIVE": ["ACHIEVE"],
"THEIR": ["THIER"],
"THIER": ["THEIR"],
"WEIRD": ["WIERD"],
"WIERD": ["WEIRD"],
"SCIENCE": ["SCINCE"],
"SCINCE": ["SCIENCE"],
"DEFINITE": ["DEFINATE"],
"DEFINATE": ["DEFINITE"],
"SEPARATE": ["SEPERATE"],
"SEPERATE": ["SEPARATE"],
"NECESSARY": ["NECCESSARY"],
"NECCESSARY": ["NECESSARY"],
"OCCURRED": ["OCCURED"],
"OCCURED": ["OCCURRED"],
"BEGINNING": ["BEGINING"],
"BEGINING": ["BEGINNING"],
"BEAUTIFUL": ["BEATIFUL"],
"BEATIFUL": ["BEAUTIFUL"],
"CALENDAR": ["CALENDER"],
"CALENDER": ["CALENDAR"],
"CEMETERY": ["CEMETARY"],
"CEMETARY": ["CEMETERY"],
"CONSCIOUS": ["CONCIOUS"],
"CONCIOUS": ["CONSCIOUS"],
"DEFINITELY": ["DEFINATELY"],
"DEFINATELY": ["DEFINITELY"],
"EMBARRASS": ["EMBARASS"],
"EMBARASS": ["EMBARRASS"],
"ENVIRONMENT": ["ENVIROMENT"],
"ENVIROMENT": ["ENVIRONMENT"],
"GOVERNMENT": ["GOVERMENT"],
"GOVERMENT": ["GOVERNMENT"],
"INDEPENDENT": ["INDEPENDANT"],
"INDEPENDANT": ["INDEPENDENT"],
"INTELLIGENCE": ["INTELIGENCE"],
"INTELIGENCE": ["INTELLIGENCE"],
"KNOWLEDGE": ["KNOWLEGE"],
"KNOWLEGE": ["KNOWLEDGE"],
"LANGUAGE": ["LANGUEGE"],
"LANGUEGE": ["LANGUAGE"],
"MAINTENANCE": ["MAINTAINENCE"],
"MAINTAINENCE": ["MAINTENANCE"],
"NOTICEABLE": ["NOTICABLE"],
"NOTICABLE": ["NOTICEABLE"],
"OCCURRENCE": ["OCCURENCE"],
"OCCURENCE": ["OCCURRENCE"],
"PRIVILEGE": ["PRIVILEDGE"],
"PRIVILEDGE": ["PRIVILEGE"],
"RESTAURANT": ["RESTARAUNT"],
"RESTARAUNT": ["RESTAURANT"],
"TOMORROW": ["TOMAROW", "TOMMOROW"],
"TOMAROW": ["TOMORROW"],
"TOMMOROW": ["TOMORROW"],
"VACUUM": ["VACCUUM"],
"VACCUUM": ["VACUUM"],
// British vs American spellings
"COLOR": ["COLOUR"],
"COLOUR": ["COLOR"],
"HONOR": ["HONOUR"],
"HONOUR": ["HONOR"],
"FAVOR": ["FAVOUR"],
"FAVOUR": ["FAVOR"],
"FLAVOR": ["FLAVOUR"],
"FLAVOUR": ["FLAVOR"],
"LABOR": ["LABOUR"],
"LABOUR": ["LABOR"],
"NEIGHBOR": ["NEIGHBOUR"],
"NEIGHBOUR": ["NEIGHBOR"],
"RUMOR": ["RUMOUR"],
"RUMOUR": ["RUMOR"],
"HUMOR": ["HUMOUR"],
"HUMOUR": ["HUMOR"],
"VAPOR": ["VAPOUR"],
"VAPOUR": ["VAPOR"],
"BEHAVIOR": ["BEHAVIOUR"],
"BEHAVIOUR": ["BEHAVIOR"],
"CENTER": ["CENTRE"],
"CENTRE": ["CENTER"],
"METER": ["METRE"],
"METRE": ["METER"],
"FIBER": ["FIBRE"],
"FIBRE": ["FIBER"],
"LITER": ["LITRE"],
"LITRE": ["LITER"],
"THEATER": ["THEATRE"],
"THEATRE": ["THEATER"],
"DEFENSE": ["DEFENCE"],
"DEFENCE": ["DEFENSE"],
"LICENSE": ["LICENCE"],
"LICENCE": ["LICENSE"],
"PRACTICE": ["PRACTISE"],
"PRACTISE": ["PRACTICE"],
"REALIZE": ["REALISE"],
"REALISE": ["REALIZE"],
"ORGANIZE": ["ORGANISE"],
"ORGANISE": ["ORGANIZE"],
"ANALYZE": ["ANALYSE"],
"ANALYSE": ["ANALYZE"],
"RECOGNIZE": ["RECOGNISE"],
"RECOGNISE": ["RECOGNIZE"],
"CRITICIZE": ["CRITICISE"],
"CRITICISE": ["CRITICIZE"],
"MEMORIZE": ["MEMORISE"],
"MEMORISE": ["MEMORIZE"],
"APOLOGIZE": ["APOLOGISE"],
"APOLOGISE": ["APOLOGIZE"],
"CATALOG": ["CATALOGUE"],
"CATALOGUE": ["CATALOG"],
"DIALOG": ["DIALOGUE"],
"DIALOGUE": ["DIALOG"],
"TRAVELER": ["TRAVELLER"],
"TRAVELLER": ["TRAVELER"],
"COUNSELOR": ["COUNSELLOR"],
"COUNSELLOR": ["COUNSELOR"],
"JEWELRY": ["JEWELLERY"],
"JEWELLERY": ["JEWELRY"],
"GRAY": ["GREY"],
"GREY": ["GRAY"],
// Turkish alternatives
"KALEM": ["QALAM"],
"QALAM": ["KALEM"],
"KITAP": ["KITAB"],
"KITAB": ["KITAP"],
"GUNES": ["GÜNES"],
"GÜNES": ["GUNES"],
"YAGMUR": ["YAĞMUR"],
"YAĞMUR": ["YAGMUR"],
"SICAK": ["SICAK"]
}, _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "SICAK", ["SICAK"]), "SOGUK", ["SOĞUK"]), "SOĞUK", ["SOGUK"]), "BUYUK", ["BÜYÜK"]), "BÜYÜK", ["BUYUK"]), "KUCUK", ["KÜÇÜK"]), "KÜÇÜK", ["KUCUK"]), "GENIS", ["GENİS"]), "GENİS", ["GENIS"]), "GUZEL", ["GÜZEL"]), _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "GÜZEL", ["GUZEL"]), "CIRKIN", ["ÇİRKİN"]), "ÇİRKİN", ["CIRKIN"]), "TEMIZ", ["TEMİZ"]), "TEMİZ", ["TEMIZ"]), "KIRLI", ["KİRLİ"]), "KİRLİ", ["KIRLI"]), "KIRMIZI", ["KIRMIZI"]), "KIRMIZI", ["KIRMIZI"]), "YESIL", ["YEŞİL"]), _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "YEŞİL", ["YESIL"]), "SARI", ["SARI"]), "SARI", ["SARI"]), "PEMBE", ["PEMBE"]), "PEMBE", ["PEMBE"]), "TURUNCU", ["TURUNCU"]), "TURUNCU", ["TURUNCU"]), "OGRETMEN", ["ÖĞRETMEN"]), "ÖĞRETMEN", ["OGRETMEN"]), "ITFAIYE", ["İTFAİYE"]), _defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2(_wordAlternatives, "İTFAİYE", ["ITFAIYE"]), "ASCI", ["AŞÇI"]), "AŞÇI", ["ASCI"]), "SOFOR", ["ŞOFÖR"]), "ŞOFÖR", ["SOFOR"]));
// Function to check if a word has valid alternatives
function getWordAlternatives(word) {
if (!word) return []; // Return empty array if word is undefined or null
var upperWord = word.toUpperCase();
return wordAlternatives[upperWord] || [];
}
// Generate 300 easy levels - each word appears only once
for (var i = 0; i < 300; i++) {
var mainWord = englishEasyWords[i];
var alternatives = getWordAlternatives(mainWord);
englishWordLists.push({
word: mainWord,
words: [],
alternatives: alternatives
});
}
// MEDIUM LEVELS (301-600): Main word + 1-2 sub-words - ensure sub-words can be made from main word letters
var englishMediumLevels = [{
word: "STREAM",
words: ["TEAM"]
}, {
word: "PLAYER",
words: ["PLAY"]
}, {
word: "MASTER",
words: ["TEAM"]
}, {
word: "WINTER",
words: ["WIN"]
}, {
word: "PLANET",
words: ["PLAN"]
}, {
word: "GARDEN",
words: ["RAGE"]
}, {
word: "LISTEN",
words: ["NEST"]
}, {
word: "DANCER",
words: ["RACE"]
}, {
word: "FRIEND",
words: ["FIRE"]
}, {
word: "MOTHER",
words: ["OTHER"]
}, {
word: "FATHER",
words: ["EARTH"]
}, {
word: "SISTER",
words: ["REST"]
}, {
word: "BROTHER",
words: ["OTHER"]
}, {
word: "TEACHER",
words: ["TEACH"]
}, {
word: "STUDENT",
words: ["NEST"]
}, {
word: "PAINTER",
words: ["PAINT"]
}, {
word: "WRITER",
words: ["WRITE"]
}, {
word: "READER",
words: ["READ"]
}, {
word: "DRIVER",
words: ["DRIVE"]
}, {
word: "SINGER",
words: ["RING"]
}, {
word: "DANCER",
words: ["DANCE"]
}, {
word: "WORKER",
words: ["WORK"]
}, {
word: "HELPER",
words: ["HELP"]
}, {
word: "LEADER",
words: ["LEAD"]
}, {
word: "FINDER",
words: ["FIND"]
}, {
word: "KEEPER",
words: ["KEEP"]
}, {
word: "LOSER",
words: ["LOSE"]
}, {
word: "WINNER",
words: ["WIN"]
}, {
word: "RUNNER",
words: ["RUN"]
}, {
word: "WALKER",
words: ["WALK"]
}, {
word: "TALKER",
words: ["TALK"]
}, {
word: "THINKER",
words: ["THINK"]
}, {
word: "DREAMER",
words: ["DREAM"]
}, {
word: "SLEEPER",
words: ["SLEEP"]
}, {
word: "WATCHER",
words: ["WATCH"]
}, {
word: "LISTENER",
words: ["LISTEN"]
}, {
word: "SPEAKER",
words: ["SPEAK"]
}, {
word: "CREATOR",
words: ["CREATE"]
}, {
word: "BUILDER",
words: ["BUILD"]
}, {
word: "FIGHTER",
words: ["FIGHT"]
}, {
word: "CLIMBER",
words: ["CLIMB"]
}, {
word: "SWIMMER",
words: ["SWIM"]
}, {
word: "JUMPER",
words: ["JUMP"]
}, {
word: "THROWER",
words: ["THROW"]
}, {
word: "CATCHER",
words: ["CATCH"]
}, {
word: "PUSHER",
words: ["PUSH"]
}, {
word: "PULLER",
words: ["PULL"]
}, {
word: "HOLDER",
words: ["HOLD"]
}, {
word: "LIFTER",
words: ["LIFT"]
}, {
word: "MOVER",
words: ["MOVE"]
}, {
word: "SHAKER",
words: ["SHAKE"]
}, {
word: "MAKER",
words: ["MAKE"]
}];
// Extend medium levels to 300 levels
var mediumWords = ["BASKET", "CASTLE", "DANGER", "ELEVEN", "FROZEN", "GROUND", "HEIGHT", "INVITE", "JACKET", "KITCHEN", "LADDER", "MOTHER", "NUMBER", "OBJECT", "PEOPLE", "QUEENS", "RESULT", "SWITCH", "TEMPLE", "UNITED", "VICTOR", "WONDER", "XAVIER", "YELLOW", "ZIPPER", "ANCHOR", "BUTTER", "CORNER", "DOUBLE", "ENERGY", "FINGER", "GOLDEN", "HEALTH", "ISLAND", "JUNGLE", "KNIGHT", "LEGEND", "MONKEY", "NEPHEW", "OYSTER", "PRETTY", "QUARTER", "RESCUE", "SIMPLE", "TURKEY", "URGENT", "VELVET", "WINTER", "XENIAL", "YOGURT"];
for (var i = 51; i < mediumWords.length && i < 300; i++) {
var word = mediumWords[i - 51];
var subword = word.substring(0, 3);
englishMediumLevels.push({
word: word,
words: [subword]
});
}
// Fill remaining slots
for (var i = 0; i < 300; i++) {
var levelData = englishMediumLevels[i % englishMediumLevels.length];
var alternatives = getWordAlternatives(levelData.word);
englishWordLists.push({
word: levelData.word,
words: levelData.words.slice(),
alternatives: alternatives
});
}
// HARD LEVELS (601-900): Main word + 2-4 sub-words
var englishHardLevels = [{
word: "STREAM",
words: ["TEAM", "STEAM", "MASTER"]
}, {
word: "PLAYER",
words: ["PLAY", "LAYER", "REPLAY"]
}, {
word: "GARDEN",
words: ["GRADE", "RANGE", "DANGER"]
}, {
word: "MASTER",
words: ["STEAM", "TEAMS", "STREAM"]
}, {
word: "LISTEN",
words: ["SILENT", "ENLIST", "TINSEL"]
}, {
word: "WONDER",
words: ["DRONE", "OWNER", "DROWN"]
}, {
word: "FRIEND",
words: ["FINDER", "FIRE", "RIDE"]
}, {
word: "MOTHER",
words: ["OTHER", "METRO", "THERMO"]
}, {
word: "FATHER",
words: ["HATER", "HEART", "EARTH"]
}, {
word: "SISTER",
words: ["RESIST", "TREES", "STEER"]
}, {
word: "BROTHER",
words: ["OTHER", "BERTH", "BOTHER"]
}, {
word: "TEACHER",
words: ["CHEATER", "CREATE", "THEATER"]
}, {
word: "STUDENT",
words: ["STUNNED", "DENTS", "TUNED"]
}, {
word: "PAINTER",
words: ["REPAINT", "PARENT", "RETINA"]
}, {
word: "WRITER",
words: ["REWRITE", "TIRE", "WIRE"]
}, {
word: "READER",
words: ["REREAD", "DEAR", "RARE"]
}, {
word: "DRIVER",
words: ["REDRIVE", "RIDE", "RIVER"]
}, {
word: "SINGER",
words: ["RESIGN", "RINGS", "REIGN"]
}, {
word: "DANCER",
words: ["RACED", "CRANE", "NECTAR"]
}, {
word: "WORKER",
words: ["REWORK", "WORK", "WORE"]
}, {
word: "HELPER",
words: ["HELP", "RELPH", "HEEL"]
}, {
word: "LEADER",
words: ["DEALER", "REAL", "LEAD"]
}, {
word: "FINDER",
words: ["FRIEND", "FIND", "FIRE"]
}, {
word: "KEEPER",
words: ["PEEK", "KEEP", "PEER"]
}, {
word: "LOSER",
words: ["ROLES", "LOSE", "SOLE"]
}, {
word: "WINNER",
words: ["INNER", "WIN", "WIRE"]
}, {
word: "RUNNER",
words: ["RUN", "RUNE", "RUER"]
}, {
word: "WALKER",
words: ["WALK", "AWKE", "REAL"]
}, {
word: "TALKER",
words: ["TALK", "REAL", "LATE"]
}, {
word: "THINKER",
words: ["THINK", "INERT", "THEIR"]
}, {
word: "DREAMER",
words: ["DREAM", "REARM", "DERMA"]
}, {
word: "SLEEPER",
words: ["SLEEP", "SPEEL", "PEERS"]
}, {
word: "WATCHER",
words: ["WATCH", "CHEAT", "CRATE"]
}, {
word: "LISTENER",
words: ["LISTEN", "SILENT", "ENLIST"]
}, {
word: "SPEAKER",
words: ["SPEAK", "PEAKS", "SEPAR"]
}, {
word: "CREATOR",
words: ["CREATE", "ACTOR", "TRACER"]
}, {
word: "BUILDER",
words: ["BUILD", "BRIDE", "RULED"]
}, {
word: "FIGHTER",
words: ["FIGHT", "EIGHT", "TIGER"]
}, {
word: "CLIMBER",
words: ["CLIMB", "CRIME", "LIMBER"]
}, {
word: "SWIMMER",
words: ["SWIM", "WIRES", "SWIMS"]
}, {
word: "JUMPER",
words: ["JUMP", "RUMP", "PURE"]
}, {
word: "THROWER",
words: ["THROW", "OTHER", "WHERE"]
}, {
word: "CATCHER",
words: ["CATCH", "CHEAT", "REACH"]
}, {
word: "PUSHER",
words: ["PUSH", "HUES", "SURE"]
}, {
word: "PULLER",
words: ["PULL", "RULE", "LURE"]
}, {
word: "HOLDER",
words: ["HOLD", "RODE", "ROLE"]
}, {
word: "LIFTER",
words: ["LIFT", "TILE", "FELT"]
}, {
word: "MOVER",
words: ["MOVE", "OVER", "ROME"]
}, {
word: "SHAKER",
words: ["SHAKE", "HEARS", "SHARE"]
}, {
word: "MAKER",
words: ["MAKE", "REAM", "MARE"]
}, {
word: "TAKER",
words: ["TAKE", "RATE", "TEAR"]
}, {
word: "GIVER",
words: ["GIVE", "RIVE", "VERI"]
}, {
word: "LOVER",
words: ["LOVE", "OVER", "ROLE"]
}];
// Extend to 300 hard levels
for (var i = 0; i < 300; i++) {
var levelData = englishHardLevels[i % englishHardLevels.length];
var alternatives = getWordAlternatives(levelData.word);
englishWordLists.push({
word: levelData.word,
words: levelData.words.slice(),
alternatives: alternatives
});
}
// EXPERT LEVELS (901-1000): Main word + 3-5 sub-words - most challenging
var englishExpertLevels = [{
word: "STREAM",
words: ["TEAM", "STEAM", "MASTER", "STREAM"]
}, {
word: "PLAYER",
words: ["PLAY", "LAYER", "REPLAY", "PARLEY"]
}, {
word: "GARDEN",
words: ["GRADE", "RANGE", "DANGER", "RANGED"]
}, {
word: "MASTER",
words: ["STEAM", "TEAMS", "STREAM", "TAMERS"]
}, {
word: "LISTEN",
words: ["SILENT", "ENLIST", "TINSEL", "INLETS"]
}, {
word: "WONDER",
words: ["DRONE", "OWNER", "DROWN", "WONDER"]
}, {
word: "FRIEND",
words: ["FINDER", "FIRE", "RIDE", "FRIED"]
}, {
word: "MOTHER",
words: ["OTHER", "METRO", "THERMO", "MOTHER"]
}, {
word: "FATHER",
words: ["HATER", "HEART", "EARTH", "FATHER"]
}, {
word: "SISTER",
words: ["RESIST", "TREES", "STEER", "SISTER"]
}, {
word: "BROTHER",
words: ["OTHER", "BERTH", "BOTHER", "BROTHER"]
}, {
word: "TEACHER",
words: ["CHEATER", "CREATE", "THEATER", "TEACHER"]
}, {
word: "STUDENT",
words: ["STUNNED", "DENTS", "TUNED", "STUDENT"]
}, {
word: "PAINTER",
words: ["REPAINT", "PARENT", "RETINA", "PAINTER"]
}, {
word: "WRITER",
words: ["REWRITE", "TIRE", "WIRE", "WRITER"]
}, {
word: "READER",
words: ["REREAD", "DEAR", "RARE", "READER"]
}, {
word: "DRIVER",
words: ["REDRIVE", "RIDE", "RIVER", "DRIVER"]
}, {
word: "SINGER",
words: ["RESIGN", "RINGS", "REIGN", "SINGER"]
}, {
word: "DANCER",
words: ["RACED", "CRANE", "NECTAR", "DANCER"]
}, {
word: "WORKER",
words: ["REWORK", "WORK", "WORE", "WORKER"]
}, {
word: "HELPER",
words: ["HELP", "RELPH", "HEEL", "HELPER"]
}, {
word: "LEADER",
words: ["DEALER", "REAL", "LEAD", "LEADER"]
}, {
word: "FINDER",
words: ["FRIEND", "FIND", "FIRE", "FINDER"]
}, {
word: "KEEPER",
words: ["PEEK", "KEEP", "PEER", "KEEPER"]
}, {
word: "LOSER",
words: ["ROLES", "LOSE", "SOLE", "LOSER"]
}, {
word: "WINNER",
words: ["INNER", "WIN", "WIRE", "WINNER"]
}, {
word: "RUNNER",
words: ["RUN", "RUNE", "RUER", "RUNNER"]
}, {
word: "WALKER",
words: ["WALK", "AWKE", "REAL", "WALKER"]
}, {
word: "TALKER",
words: ["TALK", "REAL", "LATE", "TALKER"]
}, {
word: "THINKER",
words: ["THINK", "INERT", "THEIR", "THINKER"]
}, {
word: "DREAMER",
words: ["DREAM", "REARM", "DERMA", "DREAMER"]
}, {
word: "SLEEPER",
words: ["SLEEP", "SPEEL", "PEERS", "SLEEPER"]
}, {
word: "WATCHER",
words: ["WATCH", "CHEAT", "CRATE", "WATCHER"]
}, {
word: "LISTENER",
words: ["LISTEN", "SILENT", "ENLIST", "LISTENER"]
}, {
word: "SPEAKER",
words: ["SPEAK", "PEAKS", "SEPAR", "SPEAKER"]
}, {
word: "CREATOR",
words: ["CREATE", "ACTOR", "TRACER", "CREATOR"]
}, {
word: "BUILDER",
words: ["BUILD", "BRIDE", "RULED", "BUILDER"]
}, {
word: "FIGHTER",
words: ["FIGHT", "EIGHT", "TIGER", "FIGHTER"]
}, {
word: "CLIMBER",
words: ["CLIMB", "CRIME", "LIMBER", "CLIMBER"]
}, {
word: "SWIMMER",
words: ["SWIM", "WIRES", "SWIMS", "SWIMMER"]
}, {
word: "JUMPER",
words: ["JUMP", "RUMP", "PURE", "JUMPER"]
}, {
word: "THROWER",
words: ["THROW", "OTHER", "WHERE", "THROWER"]
}, {
word: "CATCHER",
words: ["CATCH", "CHEAT", "REACH", "CATCHER"]
}, {
word: "PUSHER",
words: ["PUSH", "HUES", "SURE", "PUSHER"]
}, {
word: "PULLER",
words: ["PULL", "RULE", "LURE", "PULLER"]
}, {
word: "HOLDER",
words: ["HOLD", "RODE", "ROLE", "HOLDER"]
}, {
word: "LIFTER",
words: ["LIFT", "TILE", "FELT", "LIFTER"]
}, {
word: "MOVER",
words: ["MOVE", "OVER", "ROME", "MOVER"]
}, {
word: "SHAKER",
words: ["SHAKE", "HEARS", "SHARE", "SHAKER"]
}, {
word: "MAKER",
words: ["MAKE", "REAM", "MARE", "MAKER"]
}, {
word: "TAKER",
words: ["TAKE", "RATE", "TEAR", "TAKER"]
}, {
word: "GIVER",
words: ["GIVE", "RIVE", "VERI", "GIVER"]
}, {
word: "LOVER",
words: ["LOVE", "OVER", "ROLE", "LOVER"]
}];
// Extend to 100 expert levels
for (var i = 0; i < 100; i++) {
var levelData = englishExpertLevels[i % englishExpertLevels.length];
var alternatives = getWordAlternatives(levelData.word);
englishWordLists.push({
word: levelData.word,
words: levelData.words.slice(),
alternatives: alternatives
});
}
// Language switching function
function setLanguage(language) {
currentLanguage = language;
storage.currentLanguage = language;
if (language === 'turkish') {
wordLists = turkishWordLists;
} else {
wordLists = englishWordLists;
}
// Reset game to level 1 when switching languages
currentLevel = 0;
storage.currentLevel = 0;
currentWordData = wordLists[currentLevel % wordLists.length];
// Update all UI texts
updateAllUITexts();
}
// Function to update all UI texts based on current language
function updateAllUITexts() {
// Menu texts
titleText.setText(getString('title'));
menuCoinsText.setText(getString('money') + ': ' + coins);
menuLevelText.setText(getString('level') + ': ' + (currentLevel + 1));
// Buy hint menu texts
buyHintTitleText.setText(getString('buyHint'));
buyHintInfoText.setText(getString('oneHint'));
buyHintCoinsText.setText(getString('yourMoney') + ': ' + coins);
// Game UI texts
levelText.setText(getString('level') + ' ' + (currentLevel + 1));
coinsText.setText(getString('money') + ': ' + coins);
scoreText.setText(getString('score') + ': ' + totalScore);
hintText.setText(getString('hintText') + hintCount);
}
// Set initial language to English
wordLists = englishWordLists;
// Game state
var gameState = 'menu'; // 'menu', 'playing', 'buying'
var currentLevel = storage.currentLevel || 0;
var totalScore = storage.totalScore || 0;
var coins = storage.coins || 0;
var hintCount = storage.hintCount || 2;
var currentWordData = wordLists[currentLevel % wordLists.length];
var foundWords = [];
var selectedLetters = [];
var currentWord = "";
var letterTiles = [];
var foundWordItems = [];
var musicVolume = storage.musicVolume || 0.5;
// Main Menu Elements
var menuContainer = new Container();
game.addChild(menuContainer);
var titleText = new Text2('WORD GAME', {
size: 80,
fill: 0x2196F3
});
titleText.anchor.set(0.5, 0.5);
titleText.x = 1024;
titleText.y = 800;
menuContainer.addChild(titleText);
var startButton = menuContainer.addChild(LK.getAsset('startButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
var menuCoinsText = new Text2('COINS: ' + coins, {
size: 42,
fill: 0xFFD700
});
menuCoinsText.anchor.set(0.5, 0.5);
menuCoinsText.x = 1024;
menuCoinsText.y = 1000;
menuContainer.addChild(menuCoinsText);
var menuLevelText = new Text2('LEVEL: ' + (currentLevel + 1), {
size: 36,
fill: 0x666666
});
menuLevelText.anchor.set(0.5, 0.5);
menuLevelText.x = 1024;
menuLevelText.y = 1400;
menuContainer.addChild(menuLevelText);
// About button
var aboutButton = menuContainer.addChild(LK.getAsset('aboutButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 824,
y: 1550,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
aboutButton.down = function () {
showAboutMenu();
LK.getSound('buttonClick').play();
};
// Settings button
var settingsButton = menuContainer.addChild(LK.getAsset('settingsButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1224,
y: 1550,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
settingsButton.down = function () {
showSettingsMenu();
LK.getSound('buttonClick').play();
};
startButton.down = function () {
startGame();
initializeLetterTiles();
LK.getSound('buttonClick').play();
};
// Settings Menu Elements
var settingsContainer = new Container();
settingsContainer.visible = false;
game.addChild(settingsContainer);
var settingsTitleText = new Text2('SETTINGS', {
size: 60,
fill: 0x2196F3
});
settingsTitleText.anchor.set(0.5, 0.5);
settingsTitleText.x = 1024;
settingsTitleText.y = 600;
settingsContainer.addChild(settingsTitleText);
var musicVolumeText = new Text2('MUSIC VOLUME: ' + Math.round(musicVolume * 100) + '%', {
size: 42,
fill: 0x666666
});
musicVolumeText.anchor.set(0.5, 0.5);
musicVolumeText.x = 1024;
musicVolumeText.y = 800;
settingsContainer.addChild(musicVolumeText);
// Volume control buttons
var volumeDownButton = settingsContainer.addChild(LK.getAsset('volumeDownButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 724,
y: 900,
scaleX: 1.0,
scaleY: 1.0
}));
// Text already included in image asset - no overlay needed
var volumeUpButton = settingsContainer.addChild(LK.getAsset('volumeUpButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1324,
y: 900,
scaleX: 1.0,
scaleY: 1.0
}));
// Text already included in image asset - no overlay needed
var backFromSettingsButton = settingsContainer.addChild(LK.getAsset('backButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
// Volume control handlers
volumeDownButton.down = function () {
var oldVolume = musicVolume;
musicVolume = Math.max(0, musicVolume - 0.1);
storage.musicVolume = musicVolume;
musicVolumeText.setText('MUSIC VOLUME: ' + Math.round(musicVolume * 100) + '%');
LK.playMusic('backgroundMusic', {
volume: musicVolume
});
LK.getSound('buttonClick').play();
};
volumeUpButton.down = function () {
var oldVolume = musicVolume;
musicVolume = Math.min(1, musicVolume + 0.1);
storage.musicVolume = musicVolume;
musicVolumeText.setText('MUSIC VOLUME: ' + Math.round(musicVolume * 100) + '%');
LK.playMusic('backgroundMusic', {
volume: musicVolume
});
LK.getSound('buttonClick').play();
};
backFromSettingsButton.down = function () {
showSettingsMenu(false);
};
// About Menu Elements
var aboutContainer = new Container();
aboutContainer.visible = false;
game.addChild(aboutContainer);
var aboutTitleText = new Text2('HOW TO PLAY', {
size: 60,
fill: 0x2196F3
});
aboutTitleText.anchor.set(0.5, 0.5);
aboutTitleText.x = 1024;
aboutTitleText.y = 400;
aboutContainer.addChild(aboutTitleText);
var aboutText = new Text2('WORD PUZZLE GAME - 1000 LEVELS\n\nHOW TO PLAY:\n• Letters are arranged in a circular pattern\n• Drag from one letter to another to form words\n• Find all possible words to complete each level\n• Each word earns you 5 coins\n• Use hints when stuck (costs 50 coins)\n\nDIFFICULTY PROGRESSION:\n• Levels 1-300: EASY - Find the main word only\n• Levels 301-600: MEDIUM - Find main word + 1-2 sub-words\n• Levels 601-900: HARD - Find main word + 2-4 sub-words\n• Levels 901-1000: EXPERT - Find main word + 3-5 sub-words\n\nFEATURES:\n• Circular letter selection like phone pattern\n• Background music with volume control\n• Futuristic backgrounds every 50 levels\n• Bonus hints at certain milestones\n• Complete all 1000 levels to become a word master!', {
size: 28,
fill: 0x666666
});
aboutText.anchor.set(0.5, 0.5);
aboutText.x = 1024;
aboutText.y = 800;
aboutContainer.addChild(aboutText);
var backFromAboutButton = aboutContainer.addChild(LK.getAsset('backButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1200,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
backFromAboutButton.down = function () {
showAboutMenu(false);
};
// Buy Hint Menu Elements
var buyHintContainer = new Container();
buyHintContainer.visible = false;
game.addChild(buyHintContainer);
var buyHintTitleText = new Text2('BUY HINT', {
size: 60,
fill: 0xFF9800
});
buyHintTitleText.anchor.set(0.5, 0.5);
buyHintTitleText.x = 1024;
buyHintTitleText.y = 800;
buyHintContainer.addChild(buyHintTitleText);
var buyHintInfoText = new Text2('1 HINT = 50 COINS', {
size: 42,
fill: 0x666666
});
buyHintInfoText.anchor.set(0.5, 0.5);
buyHintInfoText.x = 1024;
buyHintInfoText.y = 1000;
buyHintContainer.addChild(buyHintInfoText);
var buyHintCoinsText = new Text2('YOUR COINS: ' + coins, {
size: 36,
fill: 0xFFD700
});
buyHintCoinsText.anchor.set(0.5, 0.5);
buyHintCoinsText.x = 1024;
buyHintCoinsText.y = 1100;
buyHintContainer.addChild(buyHintCoinsText);
var buyHintButton = buyHintContainer.addChild(LK.getAsset('buyHintButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 824,
y: 1300,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
var backFromBuyButton = buyHintContainer.addChild(LK.getAsset('backButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1224,
y: 1300,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
buyHintButton.down = function () {
buyHint();
};
backFromBuyButton.down = function () {
showBuyHintMenu(false);
};
// Game UI Container
var gameContainer = new Container();
gameContainer.visible = false;
game.addChild(gameContainer);
// UI Elements - Scaled for full screen
var levelText = new Text2('LEVEL ' + (currentLevel + 1), {
size: 54,
fill: 0x333333
});
levelText.anchor.set(0.5, 0);
levelText.x = 1024;
levelText.y = 150;
gameContainer.addChild(levelText);
var currentWordDisplay = new Text2('', {
size: 48,
fill: 0x666666
});
currentWordDisplay.anchor.set(0.5, 0.5);
currentWordDisplay.x = 1024;
currentWordDisplay.y = 650;
gameContainer.addChild(currentWordDisplay);
var coinsText = new Text2('COINS: ' + coins, {
size: 36,
fill: 0xFFD700
});
coinsText.anchor.set(1, 0);
coinsText.x = 2000;
coinsText.y = 50;
gameContainer.addChild(coinsText);
var scoreText = new Text2('SCORE: ' + totalScore, {
size: 42,
fill: 0x333333
});
scoreText.anchor.set(1, 0);
scoreText.x = 2000;
scoreText.y = 100;
gameContainer.addChild(scoreText);
var hintText = new Text2('HINTS: ' + hintCount, {
size: 36,
fill: 0xFF9800
});
hintText.anchor.set(0, 0);
hintText.x = 150;
hintText.y = 50;
gameContainer.addChild(hintText);
// Progress bar - Larger and repositioned
var progressBg = gameContainer.addChild(LK.getAsset('progressBg', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 250,
scaleX: 2,
scaleY: 1.5
}));
var progressFill = gameContainer.addChild(LK.getAsset('progressBar', {
anchorX: 0,
anchorY: 0,
x: 624,
y: 250,
scaleX: 0,
scaleY: 1.5
}));
// Submit button - Larger
var submitButton = gameContainer.addChild(LK.getAsset('submitButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 750,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
submitButton.down = function (x, y, obj) {
submitWord();
};
// Clear button - Larger and repositioned
var clearButton = gameContainer.addChild(LK.getAsset('clearButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 624,
y: 750,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
clearButton.down = function (x, y, obj) {
clearSelection();
};
// Hint button - Larger and repositioned
var hintButton = gameContainer.addChild(LK.getAsset('hintButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1424,
y: 750,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
hintButton.down = function (x, y, obj) {
useHint();
};
// Buy Hint button
var buyHintGameButton = gameContainer.addChild(LK.getAsset('buyHintButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1724,
y: 750,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
buyHintGameButton.down = function () {
showBuyHintMenu(true);
};
// Back to menu button
var backToMenuButton = gameContainer.addChild(LK.getAsset('backToMenuButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 324,
y: 750,
scaleX: 1.2,
scaleY: 1.2
}));
// Text already included in image asset - no overlay needed
backToMenuButton.down = function () {
backToMenu();
};
// Sequence input display container - Shows selected letters in order
var sequenceContainer = new Container();
sequenceContainer.x = 1024;
sequenceContainer.y = 400;
gameContainer.addChild(sequenceContainer);
// Found words container - Repositioned for full screen
var foundWordsContainer = new Container();
foundWordsContainer.x = 100;
foundWordsContainer.y = 900;
gameContainer.addChild(foundWordsContainer);
// Level completion popup container
var levelCompleteContainer = new Container();
levelCompleteContainer.visible = false;
game.addChild(levelCompleteContainer);
// Semi-transparent background overlay
var levelCompleteOverlay = levelCompleteContainer.addChild(LK.getAsset('futuristicBg2', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 1.0,
scaleY: 1.0
}));
levelCompleteOverlay.alpha = 0.8;
// Level passed text
var levelPassedText = new Text2('LEVEL PASSED!', {
size: 72,
fill: 0x4CAF50
});
levelPassedText.anchor.set(0.5, 0.5);
levelPassedText.x = 1024;
levelPassedText.y = 1200;
levelCompleteContainer.addChild(levelPassedText);
// Next level button
var nextLevelButton = levelCompleteContainer.addChild(LK.getAsset('nextLevelButtonBg', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1500,
scaleX: 1.5,
scaleY: 1.5
}));
// Text already included in image asset - no overlay needed
nextLevelButton.down = function () {
hideLevelCompletePopup();
loadNextLevel();
LK.getSound('buttonClick').play();
};
// Global variables for sequence display
var sequenceBoxes = [];
var maxSequenceLength = 12; // Maximum word length we expect
// Drag-based selection variables
var isDragging = false;
var dragStartTile = null;
var lastDraggedTile = null;
// Initialize sequence display boxes
function initializeSequenceDisplay() {
// Clear existing sequence boxes
for (var i = 0; i < sequenceBoxes.length; i++) {
sequenceBoxes[i].destroy();
}
sequenceBoxes = [];
var boxSpacing = 70;
var startX = -((maxSequenceLength - 1) * boxSpacing) / 2;
for (var i = 0; i < maxSequenceLength; i++) {
var box = new Container();
// Background box
var bg = box.attachAsset('letterTile', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.2
});
bg.alpha = 0.3;
// Letter text
var letterText = new Text2('', {
size: 40,
fill: 0x333333
});
letterText.anchor.set(0.5, 0.5);
box.addChild(letterText);
box.x = startX + i * boxSpacing;
box.letterText = letterText;
box.background = bg;
sequenceBoxes.push(box);
sequenceContainer.addChild(box);
}
}
// Update sequence display
function updateSequenceDisplay() {
for (var i = 0; i < sequenceBoxes.length; i++) {
var box = sequenceBoxes[i];
if (i < selectedLetters.length) {
var letter = selectedLetters[i].letter;
// Use proper alphabet casing
if (currentLanguage === 'turkish') {
letter = letter.toUpperCase();
} else {
letter = letter.toUpperCase();
}
box.letterText.setText(letter);
box.background.alpha = 1.0;
box.background.tint = 0x4CAF50;
} else {
box.letterText.setText('');
box.background.alpha = 0.3;
box.background.tint = 0xffffff;
}
}
}
// Initialize letter tiles
function initializeLetterTiles() {
// Clear existing tiles
for (var i = 0; i < letterTiles.length; i++) {
letterTiles[i].destroy();
}
letterTiles = [];
var letters = currentWordData.word.split('');
// Convert letters to proper alphabet
for (var i = 0; i < letters.length; i++) {
if (currentLanguage === 'turkish') {
letters[i] = letters[i].toUpperCase();
} else {
letters[i] = letters[i].toUpperCase();
}
}
// Shuffle the letters randomly
var shuffledLetters = [];
for (var i = 0; i < letters.length; i++) {
shuffledLetters.push(letters[i]);
}
// Fisher-Yates shuffle algorithm
for (var i = shuffledLetters.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = shuffledLetters[i];
shuffledLetters[i] = shuffledLetters[j];
shuffledLetters[j] = temp;
}
// Arrange letters in a circular pattern
var centerX = 1024;
var centerY = 1200;
var radius = 300;
for (var i = 0; i < shuffledLetters.length; i++) {
var tile = new LetterTile(shuffledLetters[i], i);
// Calculate circular position
var angle = i / shuffledLetters.length * 2 * Math.PI - Math.PI / 2; // Start from top
tile.x = centerX + Math.cos(angle) * radius;
tile.y = centerY + Math.sin(angle) * radius;
tile.scaleX = 1.5;
tile.scaleY = 1.5;
letterTiles.push(tile);
gameContainer.addChild(tile);
}
// Initialize sequence display
initializeSequenceDisplay();
}
// Update current word display
function updateCurrentWord() {
currentWord = '';
for (var i = 0; i < selectedLetters.length; i++) {
currentWord += selectedLetters[i].letter;
}
// Clear the display first, then set new text to prevent overlapping
currentWordDisplay.setText('');
currentWordDisplay.setText(currentWord.toUpperCase());
}
// Clear letter selection
function clearSelection() {
for (var i = 0; i < selectedLetters.length; i++) {
selectedLetters[i].setSelected(false);
}
selectedLetters = [];
currentWord = '';
// Clear display completely before setting empty text
currentWordDisplay.setText('');
currentWordDisplay.setText('');
updateSequenceDisplay();
LK.getSound('buttonClick').play();
}
// Submit word
function submitWord() {
if (currentWord.length < 3) {
LK.effects.flashObject(currentWordDisplay, 0xff0000, 500);
return;
}
var wordLower = currentWord.toLowerCase();
var isValidWord = false;
// Check if word exists in current level's word list OR is the main word itself
for (var i = 0; i < currentWordData.words.length; i++) {
if (currentWordData.words[i].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
// Also check if it's the main word itself
if (currentWordData.word.toLowerCase() === wordLower) {
isValidWord = true;
}
// Comprehensive alternative checking system
if (!isValidWord) {
// 1. Check if input word matches any alternative of the main word
var mainWordAlternatives = getWordAlternatives(currentWordData.word);
for (var i = 0; i < mainWordAlternatives.length; i++) {
if (mainWordAlternatives[i].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
// 2. Check if input word matches any alternative of sub-words
if (!isValidWord) {
for (var i = 0; i < currentWordData.words.length; i++) {
var subWordAlternatives = getWordAlternatives(currentWordData.words[i]);
for (var j = 0; j < subWordAlternatives.length; j++) {
if (subWordAlternatives[j].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
if (isValidWord) break;
}
}
// 3. Check if any alternative of input word matches main word
if (!isValidWord) {
var inputWordAlternatives = getWordAlternatives(currentWord);
for (var i = 0; i < inputWordAlternatives.length; i++) {
var altWord = inputWordAlternatives[i].toLowerCase();
if (currentWordData.word.toLowerCase() === altWord) {
isValidWord = true;
break;
}
}
}
// 4. Check if any alternative of input word matches any sub-word
if (!isValidWord) {
var inputWordAlternatives = getWordAlternatives(currentWord);
for (var i = 0; i < inputWordAlternatives.length; i++) {
var altWord = inputWordAlternatives[i].toLowerCase();
for (var j = 0; j < currentWordData.words.length; j++) {
if (currentWordData.words[j].toLowerCase() === altWord) {
isValidWord = true;
break;
}
}
if (isValidWord) break;
}
}
// 5. Check if any alternative of main word matches input word
if (!isValidWord) {
var mainWordAlternatives = getWordAlternatives(currentWordData.word);
for (var i = 0; i < mainWordAlternatives.length; i++) {
if (mainWordAlternatives[i].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
}
// 6. Check if any alternative of sub-words matches input word
if (!isValidWord) {
for (var i = 0; i < currentWordData.words.length; i++) {
var subWordAlternatives = getWordAlternatives(currentWordData.words[i]);
for (var j = 0; j < subWordAlternatives.length; j++) {
if (subWordAlternatives[j].toLowerCase() === wordLower) {
isValidWord = true;
break;
}
}
if (isValidWord) break;
}
}
}
// Check if word already found
var alreadyFound = false;
for (var i = 0; i < foundWords.length; i++) {
if (foundWords[i].toLowerCase() === wordLower) {
alreadyFound = true;
break;
}
}
if (isValidWord && !alreadyFound) {
// Word found!
var points = currentWord.length * 10;
var coinReward = 5;
foundWords.push(currentWord);
totalScore += points;
coins += coinReward;
// Add word to found words display
var wordItem = new WordItem(currentWord, points);
wordItem.y = (foundWords.length - 1) * 90;
foundWordsContainer.addChild(wordItem);
// Update UI
scoreText.setText(getString('score') + ': ' + totalScore);
coinsText.setText(getString('money') + ': ' + coins);
storage.coins = coins;
LK.setScore(totalScore);
// Calculate total possible words (including main word)
var totalPossibleWords = currentWordData.words.length + 1;
// Update progress
var progress = foundWords.length / totalPossibleWords;
progressFill.scaleX = progress;
// Play sound and flash green
LK.getSound('wordFound').play();
LK.effects.flashObject(currentWordDisplay, 0x4CAF50, 500);
// Shake animation for correct word - move left and right for 2 seconds
var originalX = currentWordDisplay.x;
tween(currentWordDisplay, {
x: originalX - 20
}, {
duration: 100,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 20
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 15
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 15
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX
}, {
duration: 100
});
}
});
}
});
}
});
}
});
}
});
}
});
// Complete level logic based on difficulty progression every 300 levels
var shouldCompleteLevel = false;
if (currentLevel < 300) {
// Easy levels (1-300): complete when main word is found
shouldCompleteLevel = currentWordData.word.toLowerCase() === wordLower;
} else if (currentLevel < 600) {
// Medium levels (301-600): complete when ALL words are found (including main word)
shouldCompleteLevel = foundWords.length >= totalPossibleWords;
} else if (currentLevel < 900) {
// Hard levels (601-900): complete when ALL words are found (including main word)
shouldCompleteLevel = foundWords.length >= totalPossibleWords;
} else {
// Expert levels (901-1000): complete when ALL words are found (including main word)
shouldCompleteLevel = foundWords.length >= totalPossibleWords;
}
if (shouldCompleteLevel) {
completeLevel();
}
clearSelection();
} else if (alreadyFound) {
LK.effects.flashObject(currentWordDisplay, 0xFFEB3B, 500);
clearSelection();
} else {
// Wrong word - red flash and shake effect
LK.effects.flashObject(currentWordDisplay, 0xff0000, 500);
// Shake animation - move left and right for 2 seconds
var originalX = currentWordDisplay.x;
tween(currentWordDisplay, {
x: originalX - 30
}, {
duration: 100,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 30
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 20
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 20
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX - 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX + 10
}, {
duration: 200,
onFinish: function onFinish() {
tween(currentWordDisplay, {
x: originalX
}, {
duration: 100
});
}
});
}
});
}
});
}
});
}
});
}
});
clearSelection();
}
}
// Use hint
function useHint() {
if (hintCount <= 0) {
LK.effects.flashObject(hintText, 0xff0000, 500);
return;
}
// Find an unfound word
var unfoundWords = [];
// Check all words in the level
for (var i = 0; i < currentWordData.words.length; i++) {
var word = currentWordData.words[i];
var found = false;
for (var j = 0; j < foundWords.length; j++) {
if (foundWords[j].toLowerCase() === word.toLowerCase()) {
found = true;
break;
}
}
if (!found) {
unfoundWords.push(word);
}
}
// Also check if main word is unfound
var mainWordFound = false;
for (var j = 0; j < foundWords.length; j++) {
if (foundWords[j].toLowerCase() === currentWordData.word.toLowerCase()) {
mainWordFound = true;
break;
}
}
if (!mainWordFound) {
unfoundWords.push(currentWordData.word);
}
if (unfoundWords.length > 0) {
var randomWord = unfoundWords[Math.floor(Math.random() * unfoundWords.length)];
// Clear current selection
clearSelection();
// Find the first letter of the word and select it
var targetLetter = randomWord.charAt(0).toUpperCase();
for (var i = 0; i < letterTiles.length; i++) {
var tile = letterTiles[i];
if (tile.letter.toUpperCase() === targetLetter && !tile.isSelected) {
selectedLetters.push(tile);
tile.setSelected(true);
updateCurrentWord();
updateSequenceDisplay();
break;
}
}
hintCount--;
hintText.setText(getString('hintText') + hintCount);
storage.hintCount = hintCount;
LK.getSound('buttonClick').play();
}
}
// Complete level
function completeLevel() {
currentLevel++;
// Check if game completed (1000 levels)
if (currentLevel >= 1000) {
// Show completion message
var completionText = new Text2(getString('completedAll'), {
size: 48,
fill: 0x4CAF50
});
completionText.anchor.set(0.5, 0.5);
completionText.x = 1024;
completionText.y = 1366;
game.addChild(completionText);
LK.showYouWin();
return;
}
// Change background every 50 levels and bonus hint
if (currentLevel % 50 === 0) {
hintCount++;
updateBackground();
var bonusText = new Text2(getString('bonusHint'), {
size: 54,
fill: 0x4CAF50
});
bonusText.anchor.set(0.5, 0.5);
bonusText.x = 1024;
bonusText.y = 2000;
bonusText.alpha = 0;
game.addChild(bonusText);
tween(bonusText, {
alpha: 1,
y: 1600
}, {
duration: 500
});
tween(bonusText, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
bonusText.destroy();
}
});
}
// Save progress
storage.currentLevel = currentLevel;
storage.totalScore = totalScore;
storage.hintCount = hintCount;
LK.getSound('levelComplete').play();
LK.effects.flashScreen(0x4CAF50, 1000);
// Show level completion popup
showLevelCompletePopup();
}
// Load next level
function loadNextLevel() {
currentWordData = wordLists[currentLevel % wordLists.length];
foundWords = [];
selectedLetters = [];
currentWord = '';
// Clear found words display
for (var i = 0; i < foundWordItems.length; i++) {
foundWordItems[i].destroy();
}
foundWordItems = [];
// Clear found words container
for (var i = foundWordsContainer.children.length - 1; i >= 0; i--) {
foundWordsContainer.children[i].destroy();
}
// Update UI
levelText.setText(getString('level') + ' ' + (currentLevel + 1));
// Clear display completely before setting empty text
currentWordDisplay.setText('');
currentWordDisplay.setText('');
hintText.setText(getString('hintText') + hintCount);
progressFill.scaleX = 0;
// Reinitialize letter tiles
initializeLetterTiles();
}
// Background management
var currentBackground = null;
function updateBackground() {
if (currentBackground) {
currentBackground.destroy();
}
var bgLevel = Math.floor(currentLevel / 50);
var bgAssetName = 'futuristicBg' + (bgLevel % 3 + 1);
currentBackground = game.addChildAt(LK.getAsset(bgAssetName, {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}), 0);
currentBackground.alpha = 0.3; // Semi-transparent so UI remains visible
}
function showAboutMenu(show) {
if (show === undefined) {
show = true;
}
if (show) {
gameState = 'about';
menuContainer.visible = false;
aboutContainer.visible = true;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = false;
} else {
gameState = 'menu';
menuContainer.visible = true;
aboutContainer.visible = false;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = false;
}
}
function showSettingsMenu(show) {
if (show === undefined) {
show = true;
}
if (show) {
gameState = 'settings';
menuContainer.visible = false;
aboutContainer.visible = false;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = true;
} else {
gameState = 'menu';
menuContainer.visible = true;
aboutContainer.visible = false;
buyHintContainer.visible = false;
gameContainer.visible = false;
settingsContainer.visible = false;
}
}
// Game state management functions
function startGame() {
gameState = 'playing';
menuContainer.visible = false;
gameContainer.visible = true;
buyHintContainer.visible = false;
aboutContainer.visible = false;
settingsContainer.visible = false;
updateBackground(); // Set initial background
// Start background music
LK.playMusic('backgroundMusic', {
fade: {
start: 0,
end: musicVolume,
duration: 1000
}
});
// Update display texts
coinsText.setText(getString('money') + ': ' + coins);
scoreText.setText(getString('score') + ': ' + totalScore);
hintText.setText(getString('hintText') + hintCount);
levelText.setText(getString('level') + ' ' + (currentLevel + 1));
}
function backToMenu() {
gameState = 'menu';
menuContainer.visible = true;
gameContainer.visible = false;
buyHintContainer.visible = false;
aboutContainer.visible = false;
settingsContainer.visible = false;
// Update menu texts
menuCoinsText.setText(getString('money') + ': ' + coins);
menuLevelText.setText(getString('level') + ': ' + (currentLevel + 1));
// Save progress
storage.currentLevel = currentLevel;
storage.totalScore = totalScore;
storage.coins = coins;
storage.hintCount = hintCount;
}
function showLevelCompletePopup() {
levelCompleteContainer.visible = true;
// Add "NEXT LEVEL" text
var nextLevelText = new Text2('NEXT LEVEL', {
size: 48,
fill: 0x2196F3
});
nextLevelText.anchor.set(0.5, 0.5);
nextLevelText.x = 1024;
nextLevelText.y = 1400;
levelCompleteContainer.addChild(nextLevelText);
// Animate the popup appearing
levelCompleteContainer.alpha = 0;
levelCompleteContainer.scaleX = 0.5;
levelCompleteContainer.scaleY = 0.5;
tween(levelCompleteContainer, {
alpha: 1,
scaleX: 1.0,
scaleY: 1.0
}, {
duration: 500,
easing: tween.easeOut
});
}
function hideLevelCompletePopup() {
tween(levelCompleteContainer, {
alpha: 0,
scaleX: 0.5,
scaleY: 0.5
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
levelCompleteContainer.visible = false;
}
});
}
function showBuyHintMenu(show) {
if (show) {
gameState = 'buying';
gameContainer.visible = false;
buyHintContainer.visible = true;
buyHintCoinsText.setText(getString('yourMoney') + ': ' + coins);
} else {
gameState = 'playing';
gameContainer.visible = true;
buyHintContainer.visible = false;
}
}
function buyHint() {
if (coins >= 50) {
coins -= 50;
hintCount++;
storage.coins = coins;
storage.hintCount = hintCount;
// Update displays
buyHintCoinsText.setText(getString('yourMoney') + ': ' + coins);
coinsText.setText(getString('money') + ': ' + coins);
hintText.setText(getString('hintText') + hintCount);
LK.effects.flashObject(buyHintCoinsText, 0x4CAF50, 500);
LK.getSound('buttonClick').play();
} else {
LK.effects.flashObject(buyHintCoinsText, 0xff0000, 500);
}
}
// Initialize first level only if playing
if (gameState === 'playing') {
initializeLetterTiles();
} else {
// Show main menu by default
menuContainer.visible = true;
gameContainer.visible = false;
buyHintContainer.visible = false;
}
// Global mouse/touch handlers for drag-based selection
game.move = function (x, y, obj) {
if (gameState === 'playing' && isDragging) {
// Check if we're over any letter tile
for (var i = 0; i < letterTiles.length; i++) {
var tile = letterTiles[i];
var tileGlobalPos = tile.parent.toGlobal(tile.position);
var gamePos = game.toLocal(tileGlobalPos);
// Check if cursor/touch is over this tile (approximate collision detection)
var distance = Math.sqrt(Math.pow(x - gamePos.x, 2) + Math.pow(y - gamePos.y, 2));
if (distance < 60 && tile !== lastDraggedTile) {
// 60 is approximate tile radius
// Add this letter to selection if not already selected
var alreadySelected = false;
for (var j = 0; j < selectedLetters.length; j++) {
if (selectedLetters[j] === tile) {
alreadySelected = true;
break;
}
}
if (!alreadySelected) {
selectedLetters.push(tile);
tile.setSelected(true);
lastDraggedTile = tile;
updateCurrentWord();
updateSequenceDisplay();
}
break;
}
}
}
};
game.up = function (x, y, obj) {
if (gameState === 'playing' && isDragging) {
// End drag selection and automatically submit word
isDragging = false;
dragStartTile = null;
lastDraggedTile = null;
// Auto-submit the formed word if it has at least 3 letters
if (selectedLetters.length >= 3) {
submitWord();
} else {
// Clear selection if word is too short
clearSelection();
}
}
};
game.update = function () {
// Only run game logic when playing
if (gameState === 'playing') {
// Game runs continuously
}
};
In the middle part, there are mountains, in the upper left corner, the sun, a river flowing from the mountain, and a house beside the river. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde hint yazan yeşil bir buton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde buy hint yazan sarı bir buton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde about yazan gri bir düğme. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde submit yazan turuncu bir buton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bir ayarlar simgesi ve kenarlarını benim için düzelt. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde start yazan yeşil bir buton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde menu yazan kırmızı bir buton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzerinde clear yazan bir buton. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
üzeinde Back yazan kırmızı bir buton . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat