/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var CharacterSlot = Container.expand(function (characterName, alternateNames, imageId) {
var self = Container.call(this);
var slotBg = self.attachAsset('characterSlot', {
anchorX: 0.5,
anchorY: 0.5
});
var questionMark = new Text2('?', {
size: 72,
fill: 0x666666
});
questionMark.anchor.set(0.5, 0.5);
self.addChild(questionMark);
var nameText = new Text2('', {
size: 24,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 1);
nameText.y = 70;
self.addChild(nameText);
self.characterName = characterName;
self.alternateNames = alternateNames || [];
self.imageId = imageId;
self.isRevealed = false;
self.slotBg = slotBg;
self.questionMark = questionMark;
self.nameText = nameText;
self.characterImage = null;
self.reveal = function () {
if (!self.isRevealed) {
self.isRevealed = true;
self.removeChild(self.slotBg);
self.slotBg = self.attachAsset('characterRevealed', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.slotBg, 0);
self.removeChild(self.questionMark);
if (self.imageId) {
self.characterImage = self.attachAsset(self.imageId, {
anchorX: 0.5,
anchorY: 0.5,
y: -10
});
}
self.nameText.setText(self.characterName.toUpperCase());
LK.getSound('correctGuess').play();
updateCounter();
}
};
self.checkGuess = function (guess) {
var normalizedGuess = guess.toLowerCase().replace(/\s+/g, '');
var normalizedName = self.characterName.toLowerCase().replace(/\s+/g, '');
if (normalizedGuess === normalizedName) {
return true;
}
for (var i = 0; i < self.alternateNames.length; i++) {
var normalizedAlt = self.alternateNames[i].toLowerCase().replace(/\s+/g, '');
if (normalizedGuess === normalizedAlt) {
return true;
}
}
return false;
};
return self;
});
var KeyboardKey = Container.expand(function (letter) {
var self = Container.call(this);
var keyBg = self.attachAsset('keyboardKey', {
anchorX: 0.5,
anchorY: 0.5
});
var keyText = new Text2(letter, {
size: 48,
fill: 0xFFFFFF
});
keyText.anchor.set(0.5, 0.5);
self.addChild(keyText);
self.letter = letter;
self.keyBg = keyBg;
self.keyText = keyText;
self.down = function (x, y, obj) {
self.removeChild(self.keyBg);
self.keyBg = self.attachAsset('keyboardKeyPressed', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.keyBg, 0);
if (self.letter === 'SPACE') {
addToInput(' ');
} else if (self.letter === 'BACK') {
removeFromInput();
} else if (self.letter === 'ENTER') {
checkCurrentGuess();
} else {
addToInput(self.letter);
}
LK.getSound('keyPress').play();
};
self.up = function (x, y, obj) {
self.removeChild(self.keyBg);
self.keyBg = self.attachAsset('keyboardKey', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.keyBg, 0);
};
return self;
});
var TabButton = Container.expand(function (categoryName, isActive) {
var self = Container.call(this);
var buttonBg = self.attachAsset(isActive ? 'tabButtonActive' : 'tabButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(categoryName, {
size: 36,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.categoryName = categoryName;
self.isActive = isActive;
self.buttonBg = buttonBg;
self.buttonText = buttonText;
self.setActive = function (active) {
self.isActive = active;
self.removeChild(self.buttonBg);
self.buttonBg = self.attachAsset(active ? 'tabButtonActive' : 'tabButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.buttonBg, 0);
};
self.down = function (x, y, obj) {
if (!self.isActive) {
setActiveTab(self.categoryName);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Character images - Retro Mode
// Character images - Super Hard Mode
// Character images - Outdoors
// Character images - Backdoors
// Character images - Rooms
// Character images - Mines
// Character images - Hotel
var categories = {
'Hotel': [{
name: 'Rush',
alts: []
}, {
name: 'Ambush',
alts: ['emboscada']
}, {
name: 'Dupe',
alts: []
}, {
name: 'Guiding light',
alts: ['Blue light', 'luz guia', 'luz azul']
}, {
name: 'Sally',
alts: ['Window']
}, {
name: 'Dread',
alts: []
}, {
name: 'Void',
alts: ['vacio']
}, {
name: 'Bob',
alts: []
}, {
name: 'El goblino',
alts: ['Goblino']
}, {
name: 'Jeff',
alts: []
}, {
name: 'Screech',
alts: ['Psst']
}, {
name: 'Halt',
alts: []
}, {
name: 'Eyes',
alts: ['The Eyes', 'ojos', 'los ojos']
}, {
name: 'Seek eyes',
alts: ['eyes seek', 'eye seek', 'seek eye']
}, {
name: 'Seek',
alts: ['buscar']
}, {
name: 'Figure',
alts: ['figura']
}, {
name: 'Hide',
alts: ['escondite']
}, {
name: 'Glitch',
alts: []
}, {
name: 'RNIUSHCG==',
alts: ['glitch rush', 'rush glitch']
}, {
name: 'AR0XMBUSH',
alts: ['glitch ambush', 'ambush glitch']
}, {
name: 'SCJVEREECH',
alts: ['glitch screech', 'screech glitch']
}, {
name: 'Timothy',
alts: ['Spider', 'araña']
}, {
name: 'Jack',
alts: []
}, {
name: 'Shadow',
alts: ['sombra']
}],
'Mines': [{
name: 'Grumble',
alts: ['gruñidos']
}, {
name: 'Giggle',
alts: ['risitas']
}, {
name: 'Seek dam',
alts: ['dam']
}, {
name: 'Seek hand',
alts: ['hand', 'mano']
}, {
name: 'Seek sludge',
alts: ['sludge', 'lodo']
}, {
name: 'Seek worm',
alts: ['worm', 'gusano']
}, {
name: 'Queen grumble',
alts: ['Q grumble', 'reina grumble', 'r grumble', 'reina gruñidos', 'r gruñidos']
}, {
name: 'Louie',
alts: ['Rat', 'Mole', 'rata', 'topo']
}, {
name: 'Gloombat',
alts: ['Gloombats']
}],
'Rooms': [{
name: 'A60',
alts: ['A-60']
}, {
name: 'A90',
alts: ['A-90']
}, {
name: 'Curious light',
alts: ['Yellow light', 'luz curiosa', 'luz amarilla']
}, {
name: 'A120',
alts: ['A-120']
}],
'Backdoors': [{
name: 'Haste',
alts: ['prisa']
}, {
name: 'Blitz',
alts: ['Red light', 'Green light']
}, {
name: 'Vacuum',
alts: []
}, {
name: 'Lookman',
alts: ['Look man']
}],
'Outdoors': [{
name: 'Groundskeeper',
alts: ['Gardener', 'jardinero']
}, {
name: 'Eyestalk',
alts: ['Tung tung tung tung seekur']
}, {
name: 'Surge',
alts: ['rayo amarillo', 'yellow lighting']
}, {
name: 'Mandrake',
alts: ['mandragora']
}, {
name: 'Monument',
alts: ['Monolith', 'monumento', 'monolito']
}, {
name: 'Snare',
alts: ['trampa de piso', 'trampa']
}, {
name: 'Caws',
alts: ['Caw', 'cuervos', 'cuervo', 'graznido']
}, {
name: 'Grampy',
alts: ['viejo', 'anciano']
}, {
name: 'World lotus',
alts: ['Lotus', 'loto']
}, {
name: 'Bramble',
alts: ['Planterna malvada', 'enredadera']
}],
'Super Hard Mode': [{
name: 'Jeff the killer',
alts: ['Jeff killer', 'killer']
}, {
name: 'Greed',
alts: []
}, {
name: 'Noob figure',
alts: ['N figure']
}, {
name: 'Soyjack',
alts: []
}, {
name: 'Jeep seek',
alts: ['car seek', 'car', 'jeep', 'seek jeep', 'seek car']
}, {
name: 'Subspace tripmine',
alts: ['S Tripmine', 'Sub trip']
}, {
name: 'Banana peel',
alts: ['Peel', 'platano']
}, {
name: 'Evil key',
alts: ['Key']
}, {
name: 'Bald Kreek',
alts: ['Kreek']
}, {
name: 'Depth',
alts: []
}, {
name: 'Trollface',
alts: []
}, {
name: 'John doe figure',
alts: ['JD figure', 'J D figure']
}],
'Retro Mode': [{
name: 'Drakobloxxer',
alts: ['Drako', 'Bloxxer']
}, {
name: 'Retro figure',
alts: ['R figure']
}, {
name: 'Seeking wall',
alts: ['Wall']
}, {
name: 'Retro rush',
alts: ['R rush']
}, {
name: 'Retro ambush',
alts: ['R ambush']
}, {
name: 'Retro screech',
alts: ['R screech']
}, {
name: 'Retro eyes',
alts: ['R eyes']
}, {
name: 'Retro el goblino',
alts: ['R el goblino', 'R goblino']
}, {
name: 'Retro bob',
alts: ['R bob']
}, {
name: 'Retro jeff',
alts: ['R jeff']
}]
};
var currentInput = '';
var activeTab = 'Hotel';
var tabButtons = {};
var characterSlots = {};
var keyboard = [];
// Create input field
var inputFieldBg = game.addChild(LK.getAsset('inputField', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 200
}));
var inputText = new Text2('', {
size: 36,
fill: 0xFFFFFF
});
inputText.anchor.set(0.5, 0.5);
inputText.x = 1024;
inputText.y = 200;
game.addChild(inputText);
var inputPrompt = new Text2('Type character name:', {
size: 28,
fill: 0xCCCCCC
});
inputPrompt.anchor.set(0.5, 1);
inputPrompt.x = 1024;
inputPrompt.y = 150;
game.addChild(inputPrompt);
// Create tabs
var tabNames = Object.keys(categories);
var tabStartX = 1024 - tabNames.length * 300 / 2 + 150;
for (var i = 0; i < tabNames.length; i++) {
var tabName = tabNames[i];
var tabButton = new TabButton(tabName, tabName === activeTab);
tabButton.x = tabStartX + i * 300;
tabButton.y = 350;
game.addChild(tabButton);
tabButtons[tabName] = tabButton;
}
// Helper function to convert character name to image asset id
function getImageId(name) {
return name.toLowerCase().replace(/\s+/g, '_').replace(/[^a-z0-9_]/g, '');
}
// Create character slots for each category
for (var categoryName in categories) {
var categoryCharacters = categories[categoryName];
characterSlots[categoryName] = [];
for (var j = 0; j < categoryCharacters.length; j++) {
var charData = categoryCharacters[j];
var imageId = getImageId(charData.name);
var slot = new CharacterSlot(charData.name, charData.alts, imageId);
characterSlots[categoryName].push(slot);
}
}
// Create keyboard
var keyboardLayout = [['!', '"', '#', '$', '%', '&', '/', '(', ')', '='], ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'], ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ñ'], ['Z', 'X', 'C', 'V', 'B', 'N', 'M', '-'], ['SPACE', 'BACK', 'ENTER']];
var keyboardStartY = 1800;
var keySpacing = 130;
for (var row = 0; row < keyboardLayout.length; row++) {
var keys = keyboardLayout[row];
var rowWidth = keys.length * keySpacing;
var rowStartX = 1024 - rowWidth / 2 + keySpacing / 2;
for (var col = 0; col < keys.length; col++) {
var key = new KeyboardKey(keys[col]);
key.x = rowStartX + col * keySpacing;
key.y = keyboardStartY + row * 120;
game.addChild(key);
keyboard.push(key);
}
}
function addToInput(_char) {
currentInput += _char;
inputText.setText(currentInput.toUpperCase());
}
function removeFromInput() {
if (currentInput.length > 0) {
currentInput = currentInput.slice(0, -1);
inputText.setText(currentInput.toUpperCase());
}
}
function checkCurrentGuess() {
if (currentInput.length === 0) {
return;
}
// Special command: Remove Eyes from list
if (currentInput.toLowerCase() === 'the worst entity') {
// Find and remove Eyes from Hotel category
var hotelSlots = characterSlots['Hotel'];
for (var i = hotelSlots.length - 1; i >= 0; i--) {
if (hotelSlots[i].characterName.toLowerCase() === 'eyes') {
// Remove from display if currently active tab is Hotel
if (activeTab === 'Hotel') {
game.removeChild(hotelSlots[i]);
}
// Remove from array
hotelSlots.splice(i, 1);
break;
}
}
currentInput = '';
inputText.setText('');
updateCounter();
return;
}
// Special command: White shadow jumpscare
if (currentInput.toLowerCase() === 'white shadow') {
// Create full screen white shadow image
var whiteShadow = game.addChild(LK.getAsset('white_shadow', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Play scary sound
LK.getSound('white_shadow_sound').play();
// Remove after 3 seconds
LK.setTimeout(function () {
game.removeChild(whiteShadow);
}, 600);
currentInput = '';
inputText.setText('');
return;
}
// Special command: Show FNAF quiz link
if (currentInput.toLowerCase() === 'gggames') {
// Create link display message
var linkMessage = new Text2('https://gggam.es/fnafquiz\n\ncopialo, que es bueno', {
size: 48,
fill: 0x00FF00
});
linkMessage.anchor.set(0.5, 0.5);
linkMessage.x = 1024;
linkMessage.y = 1000;
game.addChild(linkMessage);
// Show image and play sound after displaying the link
LK.setTimeout(function () {
// Create image display
var gggamesImage = game.addChild(LK.getAsset('GGGames', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1900
}));
// Play sound
LK.getSound('gggames_sound').play();
// Remove image after 3 seconds
LK.setTimeout(function () {
game.removeChild(gggamesImage);
}, 5000);
}, 100);
// Remove message after 5 seconds
LK.setTimeout(function () {
game.removeChild(linkMessage);
}, 5000);
currentInput = '';
inputText.setText('');
return;
}
// Special cheat code check
if (currentInput.toLowerCase() === 'reveal all' || currentInput.toLowerCase() === 'revelar todo') {
// Show cheater message
// Flash screen red to indicate cheating attempt
LK.effects.flashScreen(0xff0000, 1000);
// Create temporary message display
var cheaterMessage = new Text2('TRAMPOSO, NO VALE\nCHEATER, NO GOOD', {
size: 72,
fill: 0xFF0000
});
cheaterMessage.anchor.set(0.5, 0.5);
cheaterMessage.x = 1024;
cheaterMessage.y = 1000;
game.addChild(cheaterMessage);
// Remove message after 2 seconds
LK.setTimeout(function () {
game.removeChild(cheaterMessage);
}, 2000);
currentInput = '';
inputText.setText('');
return;
}
var slots = characterSlots[activeTab];
var foundMatch = false;
for (var i = 0; i < slots.length; i++) {
var slot = slots[i];
if (!slot.isRevealed && slot.checkGuess(currentInput)) {
slot.reveal();
currentInput = '';
inputText.setText('');
foundMatch = true;
break;
}
}
if (!foundMatch) {
LK.getSound('wrongGuess').play();
}
}
function setActiveTab(tabName) {
if (activeTab === tabName) {
return;
}
// Hide current category slots
var oldSlots = characterSlots[activeTab];
for (var i = 0; i < oldSlots.length; i++) {
game.removeChild(oldSlots[i]);
}
// Update tab buttons
tabButtons[activeTab].setActive(false);
tabButtons[tabName].setActive(true);
activeTab = tabName;
// Show new category slots
displayCharacterSlots();
// Clear input
currentInput = '';
inputText.setText('');
}
function displayCharacterSlots() {
var slots = characterSlots[activeTab];
var slotsPerRow = 7;
var slotSpacing = 260;
var rowSpacing = 200;
for (var i = 0; i < slots.length; i++) {
var slot = slots[i];
var row = Math.floor(i / slotsPerRow);
var col = i % slotsPerRow;
var rowWidth = Math.min(slots.length - row * slotsPerRow, slotsPerRow) * slotSpacing;
var startX = 1024 - rowWidth / 2 + slotSpacing / 2;
slot.x = startX + col * slotSpacing;
slot.y = 600 + row * rowSpacing;
game.addChild(slot);
}
}
// Create counter text to show progress
var counterText = new Text2('', {
size: 48,
fill: 0xFFFFFF
});
counterText.anchor.set(0.5, 0);
counterText.x = 1024;
counterText.y = 50;
game.addChild(counterText);
// Function to update counter display
function updateCounter() {
var totalEntities = 0;
var guessedEntities = 0;
// Count total and guessed entities across all categories
for (var categoryName in characterSlots) {
var slots = characterSlots[categoryName];
totalEntities += slots.length;
for (var i = 0; i < slots.length; i++) {
if (slots[i].isRevealed) {
guessedEntities++;
}
}
}
counterText.setText(guessedEntities + '/' + totalEntities);
// Check if all entities are guessed
if (guessedEntities === totalEntities && totalEntities > 0) {
// Play victory music
LK.playMusic('victoryMusic');
// Create custom victory screen
var victoryScreen = game.addChild(LK.getAsset('void', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 10,
scaleY: 25
}));
var victoryMessage = new Text2('FELICIDADES,\nARRUINASTE TU\nSANIDAD MENTAL\n\nCONGRATULATIONS,\nYOU RUINED YOUR\nMENTAL HEALTH', {
size: 64,
fill: 0xFFFFFF
});
victoryMessage.anchor.set(0.5, 0.5);
victoryMessage.x = 1024;
victoryMessage.y = 1366;
game.addChild(victoryMessage);
// Show default win screen after custom message
LK.setTimeout(function () {
LK.showYouWin();
}, 3000);
}
}
// Initialize with first category
displayCharacterSlots();
// Initialize counter
updateCounter(); /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var CharacterSlot = Container.expand(function (characterName, alternateNames, imageId) {
var self = Container.call(this);
var slotBg = self.attachAsset('characterSlot', {
anchorX: 0.5,
anchorY: 0.5
});
var questionMark = new Text2('?', {
size: 72,
fill: 0x666666
});
questionMark.anchor.set(0.5, 0.5);
self.addChild(questionMark);
var nameText = new Text2('', {
size: 24,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 1);
nameText.y = 70;
self.addChild(nameText);
self.characterName = characterName;
self.alternateNames = alternateNames || [];
self.imageId = imageId;
self.isRevealed = false;
self.slotBg = slotBg;
self.questionMark = questionMark;
self.nameText = nameText;
self.characterImage = null;
self.reveal = function () {
if (!self.isRevealed) {
self.isRevealed = true;
self.removeChild(self.slotBg);
self.slotBg = self.attachAsset('characterRevealed', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.slotBg, 0);
self.removeChild(self.questionMark);
if (self.imageId) {
self.characterImage = self.attachAsset(self.imageId, {
anchorX: 0.5,
anchorY: 0.5,
y: -10
});
}
self.nameText.setText(self.characterName.toUpperCase());
LK.getSound('correctGuess').play();
updateCounter();
}
};
self.checkGuess = function (guess) {
var normalizedGuess = guess.toLowerCase().replace(/\s+/g, '');
var normalizedName = self.characterName.toLowerCase().replace(/\s+/g, '');
if (normalizedGuess === normalizedName) {
return true;
}
for (var i = 0; i < self.alternateNames.length; i++) {
var normalizedAlt = self.alternateNames[i].toLowerCase().replace(/\s+/g, '');
if (normalizedGuess === normalizedAlt) {
return true;
}
}
return false;
};
return self;
});
var KeyboardKey = Container.expand(function (letter) {
var self = Container.call(this);
var keyBg = self.attachAsset('keyboardKey', {
anchorX: 0.5,
anchorY: 0.5
});
var keyText = new Text2(letter, {
size: 48,
fill: 0xFFFFFF
});
keyText.anchor.set(0.5, 0.5);
self.addChild(keyText);
self.letter = letter;
self.keyBg = keyBg;
self.keyText = keyText;
self.down = function (x, y, obj) {
self.removeChild(self.keyBg);
self.keyBg = self.attachAsset('keyboardKeyPressed', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.keyBg, 0);
if (self.letter === 'SPACE') {
addToInput(' ');
} else if (self.letter === 'BACK') {
removeFromInput();
} else if (self.letter === 'ENTER') {
checkCurrentGuess();
} else {
addToInput(self.letter);
}
LK.getSound('keyPress').play();
};
self.up = function (x, y, obj) {
self.removeChild(self.keyBg);
self.keyBg = self.attachAsset('keyboardKey', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.keyBg, 0);
};
return self;
});
var TabButton = Container.expand(function (categoryName, isActive) {
var self = Container.call(this);
var buttonBg = self.attachAsset(isActive ? 'tabButtonActive' : 'tabButton', {
anchorX: 0.5,
anchorY: 0.5
});
var buttonText = new Text2(categoryName, {
size: 36,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.categoryName = categoryName;
self.isActive = isActive;
self.buttonBg = buttonBg;
self.buttonText = buttonText;
self.setActive = function (active) {
self.isActive = active;
self.removeChild(self.buttonBg);
self.buttonBg = self.attachAsset(active ? 'tabButtonActive' : 'tabButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.addChildAt(self.buttonBg, 0);
};
self.down = function (x, y, obj) {
if (!self.isActive) {
setActiveTab(self.categoryName);
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
// Character images - Retro Mode
// Character images - Super Hard Mode
// Character images - Outdoors
// Character images - Backdoors
// Character images - Rooms
// Character images - Mines
// Character images - Hotel
var categories = {
'Hotel': [{
name: 'Rush',
alts: []
}, {
name: 'Ambush',
alts: ['emboscada']
}, {
name: 'Dupe',
alts: []
}, {
name: 'Guiding light',
alts: ['Blue light', 'luz guia', 'luz azul']
}, {
name: 'Sally',
alts: ['Window']
}, {
name: 'Dread',
alts: []
}, {
name: 'Void',
alts: ['vacio']
}, {
name: 'Bob',
alts: []
}, {
name: 'El goblino',
alts: ['Goblino']
}, {
name: 'Jeff',
alts: []
}, {
name: 'Screech',
alts: ['Psst']
}, {
name: 'Halt',
alts: []
}, {
name: 'Eyes',
alts: ['The Eyes', 'ojos', 'los ojos']
}, {
name: 'Seek eyes',
alts: ['eyes seek', 'eye seek', 'seek eye']
}, {
name: 'Seek',
alts: ['buscar']
}, {
name: 'Figure',
alts: ['figura']
}, {
name: 'Hide',
alts: ['escondite']
}, {
name: 'Glitch',
alts: []
}, {
name: 'RNIUSHCG==',
alts: ['glitch rush', 'rush glitch']
}, {
name: 'AR0XMBUSH',
alts: ['glitch ambush', 'ambush glitch']
}, {
name: 'SCJVEREECH',
alts: ['glitch screech', 'screech glitch']
}, {
name: 'Timothy',
alts: ['Spider', 'araña']
}, {
name: 'Jack',
alts: []
}, {
name: 'Shadow',
alts: ['sombra']
}],
'Mines': [{
name: 'Grumble',
alts: ['gruñidos']
}, {
name: 'Giggle',
alts: ['risitas']
}, {
name: 'Seek dam',
alts: ['dam']
}, {
name: 'Seek hand',
alts: ['hand', 'mano']
}, {
name: 'Seek sludge',
alts: ['sludge', 'lodo']
}, {
name: 'Seek worm',
alts: ['worm', 'gusano']
}, {
name: 'Queen grumble',
alts: ['Q grumble', 'reina grumble', 'r grumble', 'reina gruñidos', 'r gruñidos']
}, {
name: 'Louie',
alts: ['Rat', 'Mole', 'rata', 'topo']
}, {
name: 'Gloombat',
alts: ['Gloombats']
}],
'Rooms': [{
name: 'A60',
alts: ['A-60']
}, {
name: 'A90',
alts: ['A-90']
}, {
name: 'Curious light',
alts: ['Yellow light', 'luz curiosa', 'luz amarilla']
}, {
name: 'A120',
alts: ['A-120']
}],
'Backdoors': [{
name: 'Haste',
alts: ['prisa']
}, {
name: 'Blitz',
alts: ['Red light', 'Green light']
}, {
name: 'Vacuum',
alts: []
}, {
name: 'Lookman',
alts: ['Look man']
}],
'Outdoors': [{
name: 'Groundskeeper',
alts: ['Gardener', 'jardinero']
}, {
name: 'Eyestalk',
alts: ['Tung tung tung tung seekur']
}, {
name: 'Surge',
alts: ['rayo amarillo', 'yellow lighting']
}, {
name: 'Mandrake',
alts: ['mandragora']
}, {
name: 'Monument',
alts: ['Monolith', 'monumento', 'monolito']
}, {
name: 'Snare',
alts: ['trampa de piso', 'trampa']
}, {
name: 'Caws',
alts: ['Caw', 'cuervos', 'cuervo', 'graznido']
}, {
name: 'Grampy',
alts: ['viejo', 'anciano']
}, {
name: 'World lotus',
alts: ['Lotus', 'loto']
}, {
name: 'Bramble',
alts: ['Planterna malvada', 'enredadera']
}],
'Super Hard Mode': [{
name: 'Jeff the killer',
alts: ['Jeff killer', 'killer']
}, {
name: 'Greed',
alts: []
}, {
name: 'Noob figure',
alts: ['N figure']
}, {
name: 'Soyjack',
alts: []
}, {
name: 'Jeep seek',
alts: ['car seek', 'car', 'jeep', 'seek jeep', 'seek car']
}, {
name: 'Subspace tripmine',
alts: ['S Tripmine', 'Sub trip']
}, {
name: 'Banana peel',
alts: ['Peel', 'platano']
}, {
name: 'Evil key',
alts: ['Key']
}, {
name: 'Bald Kreek',
alts: ['Kreek']
}, {
name: 'Depth',
alts: []
}, {
name: 'Trollface',
alts: []
}, {
name: 'John doe figure',
alts: ['JD figure', 'J D figure']
}],
'Retro Mode': [{
name: 'Drakobloxxer',
alts: ['Drako', 'Bloxxer']
}, {
name: 'Retro figure',
alts: ['R figure']
}, {
name: 'Seeking wall',
alts: ['Wall']
}, {
name: 'Retro rush',
alts: ['R rush']
}, {
name: 'Retro ambush',
alts: ['R ambush']
}, {
name: 'Retro screech',
alts: ['R screech']
}, {
name: 'Retro eyes',
alts: ['R eyes']
}, {
name: 'Retro el goblino',
alts: ['R el goblino', 'R goblino']
}, {
name: 'Retro bob',
alts: ['R bob']
}, {
name: 'Retro jeff',
alts: ['R jeff']
}]
};
var currentInput = '';
var activeTab = 'Hotel';
var tabButtons = {};
var characterSlots = {};
var keyboard = [];
// Create input field
var inputFieldBg = game.addChild(LK.getAsset('inputField', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 200
}));
var inputText = new Text2('', {
size: 36,
fill: 0xFFFFFF
});
inputText.anchor.set(0.5, 0.5);
inputText.x = 1024;
inputText.y = 200;
game.addChild(inputText);
var inputPrompt = new Text2('Type character name:', {
size: 28,
fill: 0xCCCCCC
});
inputPrompt.anchor.set(0.5, 1);
inputPrompt.x = 1024;
inputPrompt.y = 150;
game.addChild(inputPrompt);
// Create tabs
var tabNames = Object.keys(categories);
var tabStartX = 1024 - tabNames.length * 300 / 2 + 150;
for (var i = 0; i < tabNames.length; i++) {
var tabName = tabNames[i];
var tabButton = new TabButton(tabName, tabName === activeTab);
tabButton.x = tabStartX + i * 300;
tabButton.y = 350;
game.addChild(tabButton);
tabButtons[tabName] = tabButton;
}
// Helper function to convert character name to image asset id
function getImageId(name) {
return name.toLowerCase().replace(/\s+/g, '_').replace(/[^a-z0-9_]/g, '');
}
// Create character slots for each category
for (var categoryName in categories) {
var categoryCharacters = categories[categoryName];
characterSlots[categoryName] = [];
for (var j = 0; j < categoryCharacters.length; j++) {
var charData = categoryCharacters[j];
var imageId = getImageId(charData.name);
var slot = new CharacterSlot(charData.name, charData.alts, imageId);
characterSlots[categoryName].push(slot);
}
}
// Create keyboard
var keyboardLayout = [['!', '"', '#', '$', '%', '&', '/', '(', ')', '='], ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'], ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'], ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Ñ'], ['Z', 'X', 'C', 'V', 'B', 'N', 'M', '-'], ['SPACE', 'BACK', 'ENTER']];
var keyboardStartY = 1800;
var keySpacing = 130;
for (var row = 0; row < keyboardLayout.length; row++) {
var keys = keyboardLayout[row];
var rowWidth = keys.length * keySpacing;
var rowStartX = 1024 - rowWidth / 2 + keySpacing / 2;
for (var col = 0; col < keys.length; col++) {
var key = new KeyboardKey(keys[col]);
key.x = rowStartX + col * keySpacing;
key.y = keyboardStartY + row * 120;
game.addChild(key);
keyboard.push(key);
}
}
function addToInput(_char) {
currentInput += _char;
inputText.setText(currentInput.toUpperCase());
}
function removeFromInput() {
if (currentInput.length > 0) {
currentInput = currentInput.slice(0, -1);
inputText.setText(currentInput.toUpperCase());
}
}
function checkCurrentGuess() {
if (currentInput.length === 0) {
return;
}
// Special command: Remove Eyes from list
if (currentInput.toLowerCase() === 'the worst entity') {
// Find and remove Eyes from Hotel category
var hotelSlots = characterSlots['Hotel'];
for (var i = hotelSlots.length - 1; i >= 0; i--) {
if (hotelSlots[i].characterName.toLowerCase() === 'eyes') {
// Remove from display if currently active tab is Hotel
if (activeTab === 'Hotel') {
game.removeChild(hotelSlots[i]);
}
// Remove from array
hotelSlots.splice(i, 1);
break;
}
}
currentInput = '';
inputText.setText('');
updateCounter();
return;
}
// Special command: White shadow jumpscare
if (currentInput.toLowerCase() === 'white shadow') {
// Create full screen white shadow image
var whiteShadow = game.addChild(LK.getAsset('white_shadow', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Play scary sound
LK.getSound('white_shadow_sound').play();
// Remove after 3 seconds
LK.setTimeout(function () {
game.removeChild(whiteShadow);
}, 600);
currentInput = '';
inputText.setText('');
return;
}
// Special command: Show FNAF quiz link
if (currentInput.toLowerCase() === 'gggames') {
// Create link display message
var linkMessage = new Text2('https://gggam.es/fnafquiz\n\ncopialo, que es bueno', {
size: 48,
fill: 0x00FF00
});
linkMessage.anchor.set(0.5, 0.5);
linkMessage.x = 1024;
linkMessage.y = 1000;
game.addChild(linkMessage);
// Show image and play sound after displaying the link
LK.setTimeout(function () {
// Create image display
var gggamesImage = game.addChild(LK.getAsset('GGGames', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1900
}));
// Play sound
LK.getSound('gggames_sound').play();
// Remove image after 3 seconds
LK.setTimeout(function () {
game.removeChild(gggamesImage);
}, 5000);
}, 100);
// Remove message after 5 seconds
LK.setTimeout(function () {
game.removeChild(linkMessage);
}, 5000);
currentInput = '';
inputText.setText('');
return;
}
// Special cheat code check
if (currentInput.toLowerCase() === 'reveal all' || currentInput.toLowerCase() === 'revelar todo') {
// Show cheater message
// Flash screen red to indicate cheating attempt
LK.effects.flashScreen(0xff0000, 1000);
// Create temporary message display
var cheaterMessage = new Text2('TRAMPOSO, NO VALE\nCHEATER, NO GOOD', {
size: 72,
fill: 0xFF0000
});
cheaterMessage.anchor.set(0.5, 0.5);
cheaterMessage.x = 1024;
cheaterMessage.y = 1000;
game.addChild(cheaterMessage);
// Remove message after 2 seconds
LK.setTimeout(function () {
game.removeChild(cheaterMessage);
}, 2000);
currentInput = '';
inputText.setText('');
return;
}
var slots = characterSlots[activeTab];
var foundMatch = false;
for (var i = 0; i < slots.length; i++) {
var slot = slots[i];
if (!slot.isRevealed && slot.checkGuess(currentInput)) {
slot.reveal();
currentInput = '';
inputText.setText('');
foundMatch = true;
break;
}
}
if (!foundMatch) {
LK.getSound('wrongGuess').play();
}
}
function setActiveTab(tabName) {
if (activeTab === tabName) {
return;
}
// Hide current category slots
var oldSlots = characterSlots[activeTab];
for (var i = 0; i < oldSlots.length; i++) {
game.removeChild(oldSlots[i]);
}
// Update tab buttons
tabButtons[activeTab].setActive(false);
tabButtons[tabName].setActive(true);
activeTab = tabName;
// Show new category slots
displayCharacterSlots();
// Clear input
currentInput = '';
inputText.setText('');
}
function displayCharacterSlots() {
var slots = characterSlots[activeTab];
var slotsPerRow = 7;
var slotSpacing = 260;
var rowSpacing = 200;
for (var i = 0; i < slots.length; i++) {
var slot = slots[i];
var row = Math.floor(i / slotsPerRow);
var col = i % slotsPerRow;
var rowWidth = Math.min(slots.length - row * slotsPerRow, slotsPerRow) * slotSpacing;
var startX = 1024 - rowWidth / 2 + slotSpacing / 2;
slot.x = startX + col * slotSpacing;
slot.y = 600 + row * rowSpacing;
game.addChild(slot);
}
}
// Create counter text to show progress
var counterText = new Text2('', {
size: 48,
fill: 0xFFFFFF
});
counterText.anchor.set(0.5, 0);
counterText.x = 1024;
counterText.y = 50;
game.addChild(counterText);
// Function to update counter display
function updateCounter() {
var totalEntities = 0;
var guessedEntities = 0;
// Count total and guessed entities across all categories
for (var categoryName in characterSlots) {
var slots = characterSlots[categoryName];
totalEntities += slots.length;
for (var i = 0; i < slots.length; i++) {
if (slots[i].isRevealed) {
guessedEntities++;
}
}
}
counterText.setText(guessedEntities + '/' + totalEntities);
// Check if all entities are guessed
if (guessedEntities === totalEntities && totalEntities > 0) {
// Play victory music
LK.playMusic('victoryMusic');
// Create custom victory screen
var victoryScreen = game.addChild(LK.getAsset('void', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 10,
scaleY: 25
}));
var victoryMessage = new Text2('FELICIDADES,\nARRUINASTE TU\nSANIDAD MENTAL\n\nCONGRATULATIONS,\nYOU RUINED YOUR\nMENTAL HEALTH', {
size: 64,
fill: 0xFFFFFF
});
victoryMessage.anchor.set(0.5, 0.5);
victoryMessage.x = 1024;
victoryMessage.y = 1366;
game.addChild(victoryMessage);
// Show default win screen after custom message
LK.setTimeout(function () {
LK.showYouWin();
}, 3000);
}
}
// Initialize with first category
displayCharacterSlots();
// Initialize counter
updateCounter();