User prompt
Has un menú principal donde puedas elegir de español y inglés
Code edit (1 edits merged)
Please save this source code
User prompt
Life Simulator: Rise to Success
Initial prompt
Hasme un juego de texto interactivo donde tengas que trabajar tengas opciones de que trabajo tener perder por no tener dinero y ganar dinero tener novia y más
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var ChoiceButton = Container.expand(function (text, action) { var self = Container.call(this); // Add shadow layer var buttonShadow = self.attachAsset('choiceButtonShadow', { anchorX: 0.5, anchorY: 0.5 }); buttonShadow.alpha = 0.3; buttonShadow.x = 5; buttonShadow.y = 5; // Add main button background var buttonBg = self.attachAsset('choiceButton', { anchorX: 0.5, anchorY: 0.5 }); // Add subtle glow effect var buttonGlow = self.attachAsset('choiceButtonHover', { anchorX: 0.5, anchorY: 0.5 }); buttonGlow.alpha = 0; buttonGlow.scaleX = 1.05; buttonGlow.scaleY = 1.05; var buttonText = new Text2(text, { size: 45, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.action = action; // Add hover effect self.move = function (x, y, obj) { tween(buttonGlow, { alpha: 0.2 }, { duration: 200 }); }; self.down = function (x, y, obj) { try { LK.getSound('buttonClick').play(); } catch (e) { console.log("Sound error:", e); } // Enhanced press animation tween(buttonBg, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); tween(buttonShadow, { x: 2, y: 2, alpha: 0.5 }, { duration: 100 }); tween(buttonGlow, { alpha: 0.4, scaleX: 1.02, scaleY: 1.02 }, { duration: 100 }); if (self.action) { self.action(); } }; self.up = function (x, y, obj) { tween(buttonBg, { scaleX: 1, scaleY: 1 }, { duration: 100 }); tween(buttonShadow, { x: 5, y: 5, alpha: 0.3 }, { duration: 100 }); tween(buttonGlow, { alpha: 0, scaleX: 1.05, scaleY: 1.05 }, { duration: 200 }); }; return self; }); var StatDisplay = Container.expand(function (label, value, color) { var self = Container.call(this); // Add glow background var statGlow = self.attachAsset('statBarGlow', { anchorX: 0, anchorY: 0 }); statGlow.tint = color || 0x34495e; statGlow.alpha = 0.3; statGlow.x = -10; statGlow.y = -5; var statBg = self.attachAsset('statBar', { anchorX: 0, anchorY: 0 }); statBg.tint = color || 0x34495e; // Add subtle inner glow var innerGlow = self.attachAsset('statBar', { anchorX: 0, anchorY: 0 }); innerGlow.tint = 0xffffff; innerGlow.alpha = 0.1; innerGlow.scaleX = 0.98; innerGlow.scaleY = 0.85; innerGlow.x = 15; innerGlow.y = 6; var labelText = new Text2(label + ": $" + value, { size: 40, fill: 0xFFFFFF }); labelText.anchor.set(0, 0.5); labelText.x = 20; labelText.y = 40; self.addChild(labelText); self.labelText = labelText; // Expose labelText property self.updateValue = function (newValue, prefix) { labelText.setText(label + ": " + (prefix || "$") + newValue); // Add subtle pulse animation on value update tween(statBg, { scaleX: 1.05, scaleY: 1.1 }, { duration: 150, onComplete: function onComplete() { tween(statBg, { scaleX: 1, scaleY: 1 }, { duration: 150 }); } }); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a252f }); /**** * Game Code ****/ // Sound playing wrapper function function playSound(soundId) { try { var sound = LK.getSound(soundId); if (sound && sound.play) { sound.play(); } } catch (e) { console.log("Could not play sound:", soundId, e); } } // Language and game state variables var currentLanguage = storage.language || 'english'; var playerGender = storage.gender || null; var showingLanguageMenu = true; var showingGenderMenu = false; var playerMoney = 1000; var isHomeless = storage.isHomeless || false; var playerJob = "Unemployed"; var playerSalary = 0; var playerHappiness = 50; var playerRelationship = "Single"; var playerAge = storage.playerAge || 22; var playerHealth = storage.playerHealth || 100; var playerNutrition = storage.playerNutrition || 50; var maxAge = 150; var minAge = 1; var monthsUnemployed = 0; var dayCounter = 1; var currentScene = "main"; var playerHouse = storage.playerHouse || false; var playerChildren = storage.playerChildren || 0; var monthlyChildExpenses = storage.monthlyChildExpenses || 0; var playerBelongings = storage.playerBelongings || {}; // Initialize character sprite based on gender if not already customized var currentCharacterSprite = storage.characterSprite; if (!currentCharacterSprite) { if (storage.gender === 'male') { currentCharacterSprite = 'businessCharacterSprite'; } else if (storage.gender === 'female') { currentCharacterSprite = 'artisticCharacterSprite'; } else { currentCharacterSprite = 'basicCharacterSprite'; } storage.characterSprite = currentCharacterSprite; } var characterDisplay = null; // Available items to purchase var shopItems = [{ id: "economy_car", nameKey: "economyCarName", price: 8000, happiness: 20, description: "Reliable economy car" }, { id: "luxury_car", nameKey: "luxuryCarName", price: 25000, happiness: 40, description: "High-end luxury vehicle" }, { id: "sports_car", nameKey: "sportsCarName", price: 35000, happiness: 50, description: "Fast sports car" }, { id: "suv", nameKey: "suvName", price: 18000, happiness: 30, description: "Family SUV" }, { id: "motorcycle", nameKey: "motorcycleName", price: 5000, happiness: 25, description: "Speedy motorcycle" }, { id: "ring", nameKey: "ringName", price: 3000, happiness: 15, description: "An elegant diamond ring" }, { id: "playstation", nameKey: "playstationName", price: 500, happiness: 20, description: "Latest gaming console" }, { id: "laptop", nameKey: "laptopName", price: 2000, happiness: 25, description: "High-end gaming laptop" }, { id: "watch", nameKey: "watchName", price: 5000, happiness: 18, description: "Luxury timepiece" }, { id: "bike", nameKey: "bikeName", price: 800, happiness: 12, description: "Mountain bike for adventures" }]; // Translations var translations = { english: { title: "Life Simulator: Rise to Success", selectLanguage: "Select Language / Seleccionar Idioma", english: "English", spanish: "Español", selectGender: "Select your gender:", male: "Male", female: "Female", girlfriend: "Girlfriend", boyfriend: "Boyfriend", money: "Money", job: "Job", happiness: "Happiness", relationship: "Relationship", unemployed: "Unemployed", single: "Single", welcome: "Welcome to your adult life! You're starting with $1000. What's your first move?", dayText: "Day", whatToDo: ": What would you like to do today?", lookForJob: "Look for a job", goOnDate: "Go on a date", gamble: "Go gambling", restAtHome: "Rest at home (+10 happiness)", workExtra: "Work extra hours (+money)", availableJobs: "Available job opportunities:", goBack: "Go back", congratsJob: "Congratulations! You got the job as ", noJob: "Sorry, you didn't get the job. Better luck next time!", needJobFirst: "You need a job first!", "continue": "Continue", askOut: "Ask them out ($100)", justFriends: "Just be friends", notEnoughMoney: "You don't have enough money for a proper date!", wonderfulTime: "Great! You had a wonderful time together!", dateNotWell: "The date didn't go well. Maybe next time!", friendlyChat: "You had a nice friendly conversation!", payday: "Payday! You received $", gameOver: "You've run out of money and can't find work. You're forced to move back with your parents. Game Over!", youWin: "Congratulations! You've achieved financial stability, happiness, and love. You've won at life!", dating: "Dating ", gamblingMenu: "Choose your gambling option:", lottery: "Buy lottery ticket ($50)", casino: "Go to casino ($100)", sportsBet: "Sports betting ($75)", gamblingWin: "Congratulations! You won $", gamblingLose: "You lost your bet. Better luck next time!", notEnoughMoneyGamble: "You don't have enough money to gamble!", specialEventTitle: "Special Opportunity!", headhunterOffer: "A headhunter contacts you with an exclusive job offer paying $5500/month! Do you accept?", acceptOffer: "Accept the offer", declineOffer: "Decline politely", jobOfferAccepted: "Congratulations! You accepted the high-paying position!", jobOfferDeclined: "You politely declined the offer. Maybe next time!", inheritanceMoney: "You received an unexpected inheritance of $3000 from a distant relative!", scholarshipOffer: "You've been offered a scholarship worth $2500! This will boost your qualifications.", businessOpportunity: "A friend offers you a chance to invest $1000 in their startup. It could pay off big!", investInBusiness: "Invest in the business", skipInvestment: "Skip the investment", businessSuccess: "Great news! Your investment paid off! You received $2500 back!", businessFailure: "Unfortunately, the business failed and you lost your investment.", celebrityEncounter: "You helped a celebrity and they gave you $800 as a thank you!", contestWin: "You won a local contest and received $1200 in prize money!", extras: "Extras", sellItems: "Sell your belongings", findHouse: "Look for a house", haveChildren: "Have children", visitParents: "Visit parents", lifeOptions: "Life Options", sellItemsDesc: "Sell what you own to get money", findHouseDesc: "Search for a place to live", haveChildrenDesc: "Start a family", visitParentsDesc: "Spend time with family", soldBelongings: "You sold your belongings for $", boughtHouse: "Congratulations! You bought a house for $", notEnoughForHouse: "You don't have enough money for a house!", hadChild: "Congratulations! You had a child! Happiness +20, Monthly expenses +$300", needPartnerForChild: "You need a partner to have children!", visitedParents: "You had a wonderful time with your parents! Happiness +15", housePrice: "8000", childExpenses: "300", viewBelongings: "View belongings", viewBelongingsDesc: "See what you own and buy new items", belongingsTitle: "Your Belongings & Shopping", buyItem: "Buy", alreadyOwn: "Already owned", cannotAfford: "Cannot afford", purchaseSuccess: "You bought a ", economyCarName: "Economy Car", luxuryCarName: "Luxury Car", sportsCarName: "Sports Car", suvName: "Family SUV", motorcycleName: "Motorcycle", ringName: "Diamond Ring", playstationName: "PlayStation 5", laptopName: "Gaming Laptop", watchName: "Luxury Watch", bikeName: "Mountain Bike", age: "Age", health: "Health", nutrition: "Nutrition", eatHealthy: "Eat healthy food (+20 nutrition, +5 health)", eatJunk: "Eat junk food (+5 nutrition, -2 health)", exercise: "Exercise (+10 health, +5 happiness)", rest: "Get medical checkup (+15 health)", ageAdvanced: "Happy Birthday! You are now", yearsOld: "years old", diedOfAge: "You lived a full life and passed away peacefully at age", diedOfHealth: "Your poor health caught up with you. You passed away at age", gameOverAge: "Game Over - You have reached the end of your natural life.", gameOverHealth: "Game Over - Your health deteriorated beyond recovery.", homelessMode: "Homeless Mode", startHomeless: "Start as homeless", survivalOptions: "Survival options", searchFood: "Search for food in dumpsters", askMoney: "Ask for money on the street", sleepShelter: "Sleep in shelter", tempWork: "Look for temporary work", socialHelp: "Try to get social help", customizeCharacter: "Customize character", characterCustomization: "Character Customization", selectCharacterSprite: "Select your character appearance:", basicCharacter: "Basic Character", businessCharacter: "Business Person", casualCharacter: "Casual Person", artisticCharacter: "Artistic Person", sportCharacter: "Athletic Person", maleExecutive: "Executive Man", maleCasual: "Casual Man", maleWorker: "Working Man", maleAthletic: "Athletic Man", characterChanged: "Your character appearance has been updated!" }, spanish: { title: "Simulador de Vida: Camino al Éxito", selectLanguage: "Select Language / Seleccionar Idioma", english: "English", spanish: "Español", selectGender: "Selecciona tu género:", male: "Hombre", female: "Mujer", girlfriend: "Novia", boyfriend: "Novio", money: "Dinero", job: "Trabajo", happiness: "Felicidad", relationship: "Relación", unemployed: "Desempleado", single: "Soltero", welcome: "¡Bienvenido a tu vida adulta! Empiezas con $1000. ¿Cuál es tu primer movimiento?", dayText: "Día", whatToDo: ": ¿Qué te gustaría hacer hoy?", lookForJob: "Buscar trabajo", goOnDate: "Ir a una cita", gamble: "Ir a apostar", restAtHome: "Descansar en casa (+10 felicidad)", workExtra: "Trabajar horas extra (+dinero)", availableJobs: "Oportunidades de trabajo disponibles:", goBack: "Volver", congratsJob: "¡Felicidades! Conseguiste el trabajo como ", noJob: "Lo siento, no conseguiste el trabajo. ¡Mejor suerte la próxima vez!", needJobFirst: "¡Necesitas un trabajo primero!", "continue": "Continuar", askOut: "Invitarla/o a salir ($100)", justFriends: "Solo ser amigos", notEnoughMoney: "¡No tienes suficiente dinero para una cita apropiada!", wonderfulTime: "¡Genial! ¡Pasaron un tiempo maravilloso juntos!", dateNotWell: "La cita no fue bien. ¡Tal vez la próxima vez!", friendlyChat: "¡Tuviste una conversación amistosa agradable!", payday: "¡Día de pago! Recibiste $", gameOver: "Te quedaste sin dinero y no puedes encontrar trabajo. Te ves obligado a regresar con tus padres. ¡Fin del juego!", youWin: "¡Felicidades! Has logrado estabilidad financiera, felicidad y amor. ¡Has ganado en la vida!", dating: "Saliendo con ", gamblingMenu: "Elige tu opción de apuesta:", lottery: "Comprar boleto de lotería ($50)", casino: "Ir al casino ($100)", sportsBet: "Apuestas deportivas ($75)", gamblingWin: "¡Felicidades! Ganaste $", gamblingLose: "Perdiste tu apuesta. ¡Mejor suerte la próxima vez!", notEnoughMoneyGamble: "¡No tienes suficiente dinero para apostar!", specialEventTitle: "¡Oportunidad Especial!", headhunterOffer: "¡Un cazatalentos te contacta con una oferta de trabajo exclusiva que paga $5500/mes! ¿Aceptas?", acceptOffer: "Aceptar la oferta", declineOffer: "Declinar cortésmente", jobOfferAccepted: "¡Felicidades! Aceptaste el puesto bien remunerado!", jobOfferDeclined: "Declinaste cortésmente la oferta. ¡Tal vez la próxima vez!", inheritanceMoney: "¡Recibiste una herencia inesperada de $3000 de un pariente lejano!", scholarshipOffer: "¡Te han ofrecido una beca por valor de $2500! Esto mejorará tus calificaciones.", businessOpportunity: "Un amigo te ofrece la oportunidad de invertir $1000 en su startup. ¡Podría dar grandes frutos!", investInBusiness: "Invertir en el negocio", skipInvestment: "Omitir la inversión", businessSuccess: "¡Grandes noticias! ¡Tu inversión dio frutos! ¡Recibiste $2500 de vuelta!", businessFailure: "Desafortunadamente, el negocio falló y perdiste tu inversión.", celebrityEncounter: "¡Ayudaste a una celebridad y te dio $800 como agradecimiento!", contestWin: "¡Ganaste un concurso local y recibiste $1200 en dinero del premio!", extras: "Extras", sellItems: "Vender tus pertenencias", findHouse: "Buscar casa", haveChildren: "Tener hijos", visitParents: "Visitar padres", lifeOptions: "Opciones de Vida", sellItemsDesc: "Vende lo que tienes para obtener dinero", findHouseDesc: "Busca un lugar donde vivir", haveChildrenDesc: "Formar una familia", visitParentsDesc: "Pasar tiempo con la familia", soldBelongings: "Vendiste tus pertenencias por $", boughtHouse: "¡Felicidades! Compraste una casa por $", notEnoughForHouse: "¡No tienes suficiente dinero para una casa!", hadChild: "¡Felicidades! Tuviste un hijo! Felicidad +20, Gastos mensuales +$300", needPartnerForChild: "¡Necesitas una pareja para tener hijos!", visitedParents: "¡Pasaste un tiempo maravilloso con tus padres! Felicidad +15", housePrice: "8000", childExpenses: "300", viewBelongings: "Ver pertenencias", viewBelongingsDesc: "Ve lo que tienes y compra nuevos artículos", belongingsTitle: "Tus Pertenencias y Compras", buyItem: "Comprar", alreadyOwn: "Ya lo tienes", cannotAfford: "No puedes permitirte", purchaseSuccess: "Compraste un ", economyCarName: "Auto Económico", luxuryCarName: "Auto de Lujo", sportsCarName: "Auto Deportivo", suvName: "SUV Familiar", motorcycleName: "Motocicleta", ringName: "Anillo de Diamante", playstationName: "PlayStation 5", laptopName: "Laptop Gamer", watchName: "Reloj de Lujo", bikeName: "Bicicleta de Montaña", age: "Edad", health: "Salud", nutrition: "Nutrición", eatHealthy: "Comer comida saludable (+20 nutrición, +5 salud)", eatJunk: "Comer comida chatarra (+5 nutrición, -2 salud)", exercise: "Hacer ejercicio (+10 salud, +5 felicidad)", rest: "Hacerse un chequeo médico (+15 salud)", ageAdvanced: "¡Feliz Cumpleaños! Ahora tienes", yearsOld: "años", diedOfAge: "Viviste una vida plena y falleciste en paz a los", diedOfHealth: "Tu mala salud te alcanzó. Falleciste a los", gameOverAge: "Fin del Juego - Has llegado al final de tu vida natural.", gameOverHealth: "Fin del Juego - Tu salud se deterioró sin posibilidad de recuperación.", homelessMode: "Modo Vagabundo", startHomeless: "Comenzar como vagabundo", survivalOptions: "Opciones de supervivencia", searchFood: "Buscar comida en basureros", askMoney: "Pedir dinero en la calle", sleepShelter: "Dormir en refugio", tempWork: "Buscar trabajo temporal", socialHelp: "Intentar conseguir ayuda social", customizeCharacter: "Personalizar personaje", characterCustomization: "Personalización del Personaje", selectCharacterSprite: "Selecciona la apariencia de tu personaje:", basicCharacter: "Personaje Básico", businessCharacter: "Persona de Negocios", casualCharacter: "Persona Casual", artisticCharacter: "Persona Artística", sportCharacter: "Persona Atlética", maleExecutive: "Hombre Ejecutivo", maleCasual: "Hombre Casual", maleWorker: "Hombre Trabajador", maleAthletic: "Hombre Atlético", characterChanged: "¡La apariencia de tu personaje ha sido actualizada!" } }; function getText(key) { return translations[currentLanguage][key] || key; } // Job data with translations and hiring probabilities var availableJobs = [{ nameEn: "Fast Food Worker", nameEs: "Trabajador de Comida Rápida", salary: 1200, requirements: "None", happiness: -5, hireChance: 0.85 // 85% chance - easy to get }, { nameEn: "Retail Associate", nameEs: "Asociado de Ventas", salary: 1400, requirements: "None", happiness: -3, hireChance: 0.80 // 80% chance }, { nameEn: "Warehouse Worker", nameEs: "Trabajador de Almacén", salary: 1600, requirements: "Physical Fitness", happiness: -2, hireChance: 0.75 // 75% chance }, { nameEn: "Delivery Driver", nameEs: "Conductor de Entrega", salary: 1800, requirements: "Driver's License", happiness: 2, hireChance: 0.70 // 70% chance }, { nameEn: "Office Assistant", nameEs: "Asistente de Oficina", salary: 2000, requirements: "High School", happiness: 0, hireChance: 0.65 // 65% chance }, { nameEn: "Customer Service Rep", nameEs: "Representante de Servicio al Cliente", salary: 2200, requirements: "Communication Skills", happiness: -1, hireChance: 0.60 // 60% chance }, { nameEn: "Security Guard", nameEs: "Guardia de Seguridad", salary: 2400, requirements: "Background Check", happiness: 3, hireChance: 0.55 // 55% chance }, { nameEn: "Bank Teller", nameEs: "Cajero de Banco", salary: 2800, requirements: "Some Experience", happiness: 5, hireChance: 0.50 // 50% chance }, { nameEn: "Receptionist", nameEs: "Recepcionista", salary: 2600, requirements: "Professional Appearance", happiness: 4, hireChance: 0.52 // 52% chance }, { nameEn: "Sales Associate", nameEs: "Asociado de Ventas", salary: 3000, requirements: "Sales Experience", happiness: 6, hireChance: 0.45 // 45% chance }, { nameEn: "Administrative Assistant", nameEs: "Asistente Administrativo", salary: 3200, requirements: "Office Skills", happiness: 7, hireChance: 0.42 // 42% chance }, { nameEn: "Bookkeeper", nameEs: "Tenedor de Libros", salary: 3500, requirements: "Accounting Knowledge", happiness: 8, hireChance: 0.38 // 38% chance }, { nameEn: "Manager", nameEs: "Gerente", salary: 4200, requirements: "Leadership Experience", happiness: 10, hireChance: 0.35 // 35% chance }, { nameEn: "Marketing Specialist", nameEs: "Especialista en Marketing", salary: 4500, requirements: "Marketing Degree", happiness: 12, hireChance: 0.32 // 32% chance }, { nameEn: "Accountant", nameEs: "Contador", salary: 4800, requirements: "Accounting Degree", happiness: 11, hireChance: 0.30 // 30% chance }, { nameEn: "Software Developer", nameEs: "Desarrollador de Software", salary: 5000, requirements: "College Degree", happiness: 15, hireChance: 0.28 // 28% chance }, { nameEn: "Project Manager", nameEs: "Gerente de Proyecto", salary: 5500, requirements: "Management Experience", happiness: 13, hireChance: 0.25 // 25% chance }, { nameEn: "Senior Developer", nameEs: "Desarrollador Senior", salary: 6000, requirements: "5+ Years Experience", happiness: 18, hireChance: 0.22 // 22% chance }, { nameEn: "Data Analyst", nameEs: "Analista de Datos", salary: 5800, requirements: "Statistics Knowledge", happiness: 16, hireChance: 0.24 // 24% chance }, { nameEn: "Engineering Manager", nameEs: "Gerente de Ingeniería", salary: 7000, requirements: "Engineering Degree + Leadership", happiness: 20, hireChance: 0.18 // 18% chance }, { nameEn: "Senior Manager", nameEs: "Gerente Senior", salary: 7500, requirements: "MBA + Experience", happiness: 22, hireChance: 0.15 // 15% chance }, { nameEn: "Director", nameEs: "Director", salary: 8500, requirements: "Executive Experience", happiness: 25, hireChance: 0.12 // 12% chance }, { nameEn: "VP of Operations", nameEs: "VP de Operaciones", salary: 10000, requirements: "Senior Leadership", happiness: 28, hireChance: 0.08 // 8% chance }, { nameEn: "CEO", nameEs: "Director Ejecutivo", salary: 15000, requirements: "Extensive Leadership", happiness: 35, hireChance: 0.05 // 5% chance - very rare }]; function getJobName(job) { return currentLanguage === 'spanish' ? job.nameEs : job.nameEn; } var relationships = [{ nameEn: "Coffee Shop Regular", nameEs: "Cliente Habitual del Café", status: "Stranger", happiness: 5 }, { nameEn: "Gym Partner", nameEs: "Compañero de Gimnasio", status: "Acquaintance", happiness: 8 }, { nameEn: "Coworker", nameEs: "Compañero de Trabajo", status: "Friend", happiness: 12 }]; function getPersonName(person) { return currentLanguage === 'spanish' ? person.nameEs : person.nameEn; } // UI Elements - Enhanced with visual effects // Add gradient background var backgroundGradient = game.addChild(LK.getAsset('backgroundGradient', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); backgroundGradient.alpha = 0.8; var backgroundPanel = game.addChild(LK.getAsset('backgroundPanel', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); // Add subtle animation to background tween(backgroundPanel, { scaleX: 1.02, scaleY: 1.02 }, { duration: 3000, yoyo: true, repeat: -1 }); // Enhanced title with background and glow var titleBackground = game.addChild(LK.getAsset('titleBackground', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 190 })); titleBackground.alpha = 0.8; var titleText = new Text2(getText('selectLanguage'), { size: 60, fill: 0xFFFFFF }); titleText.anchor.set(0.5, 0); titleText.x = 1024; titleText.y = 150; game.addChild(titleText); // Add subtle title animation tween(titleText, { y: 145 }, { duration: 2000, yoyo: true, repeat: -1 }); // Stats display var moneyDisplay = game.addChild(new StatDisplay(getText('money'), playerMoney, 0x27ae60)); moneyDisplay.x = 224; moneyDisplay.y = 250; var jobDisplay = game.addChild(new StatDisplay(getText('job'), getText('unemployed'), 0x8e44ad)); jobDisplay.x = 224; jobDisplay.y = 350; jobDisplay.updateValue(getText('unemployed'), ""); var happinessDisplay = game.addChild(new StatDisplay(getText('happiness'), playerHappiness + "%", 0xf39c12)); happinessDisplay.x = 224; happinessDisplay.y = 450; happinessDisplay.updateValue(playerHappiness + "%", ""); var relationshipDisplay = game.addChild(new StatDisplay(getText('relationship'), getText('single'), 0xe91e63)); relationshipDisplay.x = 224; relationshipDisplay.y = 550; relationshipDisplay.updateValue(getText('single'), ""); // Player data displays - will be shown in separate menu var ageDisplay = null; var healthDisplay = null; var nutritionDisplay = null; // Character display characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, { anchorX: 0.5, anchorY: 0.5, x: 1650, y: 400 })); characterDisplay.scaleX = 0.8; characterDisplay.scaleY = 0.8; // Event panel - Enhanced with glow effect var eventPanelGlow = game.addChild(LK.getAsset('eventPanelGlow', { anchorX: 0.5, anchorY: 0, x: 1024, y: 690 })); eventPanelGlow.alpha = 0.4; var eventPanel = game.addChild(LK.getAsset('eventPanel', { anchorX: 0.5, anchorY: 0, x: 1024, y: 700 })); // Add subtle breathing animation to event panel tween(eventPanel, { scaleX: 1.01, scaleY: 1.01 }, { duration: 4000, yoyo: true, repeat: -1 }); var eventText = new Text2(getText('selectLanguage'), { size: 42, fill: 0xFFFFFF }); eventText.anchor.set(0.5, 0); eventText.x = 1024; eventText.y = 750; game.addChild(eventText); // Choice buttons var choiceButtons = []; function clearChoices() { for (var i = 0; i < choiceButtons.length; i++) { choiceButtons[i].destroy(); } choiceButtons = []; } function addChoice(text, action) { var button = new ChoiceButton(text, action); button.x = 1024; button.y = 1200 + choiceButtons.length * 140; // Add entrance animation button.alpha = 0; button.scaleX = 0.8; button.scaleY = 0.8; game.addChild(button); choiceButtons.push(button); // Animate button entrance with staggered timing tween(button, { alpha: 1, scaleX: 1, scaleY: 1 }, { duration: 300, delay: choiceButtons.length * 50 }); } function showLanguageMenu() { titleText.setText(getText('selectLanguage')); eventText.setText(getText('selectLanguage')); clearChoices(); addChoice(getText('english'), function () { currentLanguage = 'english'; storage.language = 'english'; showingLanguageMenu = false; showingGenderMenu = true; updateUILanguage(); showGenderMenu(); }); addChoice(getText('spanish'), function () { currentLanguage = 'spanish'; storage.language = 'spanish'; showingLanguageMenu = false; showingGenderMenu = true; updateUILanguage(); showGenderMenu(); }); } function showGenderMenu() { titleText.setText(getText('title')); eventText.setText(getText('selectGender')); clearChoices(); addChoice(getText('male'), function () { playerGender = 'male'; storage.gender = 'male'; playerRelationship = getText('single'); // Set default male character sprite currentCharacterSprite = 'businessCharacterSprite'; storage.characterSprite = 'businessCharacterSprite'; // Update character display if (characterDisplay) { characterDisplay.destroy(); } characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, { anchorX: 0.5, anchorY: 0.5, x: 1650, y: 400 })); characterDisplay.scaleX = 0.8; characterDisplay.scaleY = 0.8; showingGenderMenu = false; updateUILanguage(); showMainMenu(); }); addChoice(getText('female'), function () { playerGender = 'female'; storage.gender = 'female'; playerRelationship = getText('single'); // Set default female character sprite currentCharacterSprite = 'artisticCharacterSprite'; storage.characterSprite = 'artisticCharacterSprite'; // Update character display if (characterDisplay) { characterDisplay.destroy(); } characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, { anchorX: 0.5, anchorY: 0.5, x: 1650, y: 400 })); characterDisplay.scaleX = 0.8; characterDisplay.scaleY = 0.8; showingGenderMenu = false; updateUILanguage(); showMainMenu(); }); } function updateUILanguage() { titleText.setText(getText('title')); moneyDisplay.labelText.setText(getText('money') + ": $" + playerMoney); jobDisplay.labelText.setText(getText('job') + ": " + (playerJob === "Unemployed" ? getText('unemployed') : playerJob)); happinessDisplay.labelText.setText(getText('happiness') + ": " + playerHappiness + "%"); relationshipDisplay.labelText.setText(getText('relationship') + ": " + (playerRelationship === "Single" ? getText('single') : playerRelationship)); if (ageDisplay) ageDisplay.labelText.setText(getText('age') + ": " + playerAge); if (healthDisplay) healthDisplay.labelText.setText(getText('health') + ": " + playerHealth + "%"); if (nutritionDisplay) nutritionDisplay.labelText.setText(getText('nutrition') + ": " + playerNutrition + "%"); } function updateStats() { moneyDisplay.updateValue(playerMoney); var jobText = playerJob === "Unemployed" ? getText('unemployed') : playerJob; jobDisplay.updateValue(jobText, ""); happinessDisplay.updateValue(playerHappiness + "%", ""); var relationshipText = playerRelationship === "Single" ? getText('single') : playerRelationship; relationshipDisplay.updateValue(relationshipText, ""); if (ageDisplay) ageDisplay.updateValue(playerAge, ""); if (healthDisplay) healthDisplay.updateValue(playerHealth + "%", ""); if (nutritionDisplay) nutritionDisplay.updateValue(playerNutrition + "%", ""); } function checkGameOver() { // Check age limit if (playerAge >= maxAge) { eventText.setText(getText('diedOfAge') + " " + playerAge + ". " + getText('gameOverAge')); clearChoices(); playSound('failure'); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } // Check health if (playerHealth <= 0) { eventText.setText(getText('diedOfHealth') + " " + playerAge + ". " + getText('gameOverHealth')); clearChoices(); playSound('failure'); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } // Check happiness - death from depression/suicide if (playerHappiness <= 0) { eventText.setText(currentLanguage === 'spanish' ? "Tu felicidad llegó a cero. La depresión te venció y falleciste a los " + playerAge + " años. Fin del Juego - La vida sin felicidad no puede continuar." : "Your happiness reached zero. Depression overcame you and you passed away at age " + playerAge + ". Game Over - Life without happiness cannot continue."); clearChoices(); playSound('failure'); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } // Check combined low health and happiness - death from poor life conditions if (playerHealth <= 10 && playerHappiness <= 10) { eventText.setText(currentLanguage === 'spanish' ? "Tu mala salud combinada con muy baja felicidad resultó en tu muerte a los " + playerAge + " años. Fin del Juego - No pudiste mantener las condiciones básicas para vivir." : "Your poor health combined with very low happiness resulted in your death at age " + playerAge + ". Game Over - You couldn't maintain basic living conditions."); clearChoices(); playSound('failure'); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } if (playerMoney <= 0 && monthsUnemployed >= 3) { eventText.setText(getText('gameOver')); clearChoices(); playSound('failure'); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } if (playerMoney >= 10000 && playerHappiness >= 80 && playerRelationship !== getText('single')) { eventText.setText(getText('youWin')); clearChoices(); playSound('success'); LK.setTimeout(function () { LK.showYouWin(); }, 2000); return true; } return false; } function showMainMenu() { currentScene = "main"; eventText.setText(getText('dayText') + " " + dayCounter + getText('whatToDo')); clearChoices(); addChoice(getText('lookForJob'), function () { showJobSearch(); }); addChoice(getText('goOnDate'), function () { showDating(); }); addChoice(getText('gamble'), function () { showGambling(); }); addChoice(getText('restAtHome'), function () { playerHappiness = Math.min(100, playerHappiness + 10); playerMoney -= 50; // Daily expenses advanceDay(); }); addChoice(getText('workExtra'), function () { if (playerJob === "Unemployed") { eventText.setText(getText('needJobFirst')); return; } playerMoney += Math.floor(playerSalary * 0.3); playerHappiness = Math.max(0, playerHappiness - 5); playerMoney -= 50; // Daily expenses advanceDay(); }); addChoice(getText('extras'), function () { showExtrasMenu(); }); } function showJobSearch() { currentScene = "jobs"; eventText.setText(getText('availableJobs')); clearChoices(); // Create a shuffled copy of available jobs and show random 4-6 jobs var shuffledJobs = availableJobs.slice(); for (var i = shuffledJobs.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = shuffledJobs[i]; shuffledJobs[i] = shuffledJobs[j]; shuffledJobs[j] = temp; } var numJobsToShow = Math.floor(Math.random() * 3) + 4; // Show 4-6 jobs for (var i = 0; i < Math.min(numJobsToShow, shuffledJobs.length); i++) { var job = shuffledJobs[i]; (function (jobData) { var chanceText = ""; if (jobData.hireChance >= 0.7) { chanceText = currentLanguage === 'spanish' ? " (Alta probabilidad)" : " (High chance)"; } else if (jobData.hireChance >= 0.4) { chanceText = currentLanguage === 'spanish' ? " (Probabilidad media)" : " (Medium chance)"; } else { chanceText = currentLanguage === 'spanish' ? " (Baja probabilidad)" : " (Low chance)"; } addChoice(getJobName(jobData) + " ($" + jobData.salary + "/month)" + chanceText, function () { applyForJob(jobData); }); })(job); } addChoice(getText('goBack'), function () { showMainMenu(); }); } function applyForJob(job) { var chance = Math.random(); var actualHireChance = job.hireChance; // Character appearance affects hiring probability var characterModifier = 1.0; var characterBonus = ""; switch (currentCharacterSprite) { case 'businessCharacterSprite': // Business appearance gives advantage for office jobs and high-paying positions if (job.salary >= 3000) { characterModifier = 1.3; // 30% better chance for higher-paying jobs characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional impresiona al empleador." : " Your professional appearance impresses the employer."; } else { characterModifier = 1.1; // 10% better chance for all jobs characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional ayuda." : " Your professional appearance helps."; } break; case 'casualCharacterSprite': // Casual appearance is neutral but good for customer service and retail if (job.nameEn.includes("Customer") || job.nameEn.includes("Retail") || job.nameEn.includes("Sales")) { characterModifier = 1.2; // 20% better for customer-facing roles characterBonus = currentLanguage === 'spanish' ? " Tu apariencia relajada es perfecta para este trabajo." : " Your approachable appearance is perfect for this role."; } else { characterModifier = 1.0; // No change } break; case 'artisticCharacterSprite': // Artistic appearance is great for creative roles but poor for traditional business if (job.nameEn.includes("Marketing") || job.salary <= 2000) { characterModifier = 1.25; // 25% better for creative/entry-level roles characterBonus = currentLanguage === 'spanish' ? " Tu apariencia creativa destaca positivamente." : " Your creative appearance stands out positively."; } else if (job.salary >= 4000) { characterModifier = 0.7; // 30% worse for high-paying traditional roles characterBonus = currentLanguage === 'spanish' ? " Tu apariencia poco convencional preocupa al empleador." : " Your unconventional appearance concerns the employer."; } else { characterModifier = 0.9; // 10% worse for mid-level traditional roles } break; case 'sportCharacterSprite': // Athletic appearance is great for physical jobs and security if (job.nameEn.includes("Warehouse") || job.nameEn.includes("Security") || job.nameEn.includes("Delivery") || job.nameEn.includes("Driver")) { characterModifier = 1.4; // 40% better for physical jobs characterBonus = currentLanguage === 'spanish' ? " Tu apariencia atlética es perfecta para este trabajo físico." : " Your athletic appearance is perfect for this physical job."; } else if (job.salary >= 5000) { characterModifier = 0.8; // 20% worse for high-level office jobs characterBonus = currentLanguage === 'spanish' ? " El empleador prefiere una apariencia más formal." : " The employer prefers a more formal appearance."; } else { characterModifier = 1.0; // No change for other jobs } break; case 'maleExecutiveSprite': // Executive male appearance is excellent for high-level positions if (job.salary >= 4000) { characterModifier = 1.5; // 50% better chance for high-paying executive jobs characterBonus = currentLanguage === 'spanish' ? " Tu apariencia ejecutiva impresiona mucho al empleador." : " Your executive appearance greatly impresses the employer."; } else if (job.salary >= 2000) { characterModifier = 1.2; // 20% better for mid-level jobs characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional es muy respetada." : " Your professional appearance is highly respected."; } else { characterModifier = 1.1; // Still good for entry-level characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional ayuda." : " Your professional appearance helps."; } break; case 'maleCasualSprite': // Casual male appearance is good for customer service and relaxed environments if (job.nameEn.includes("Customer") || job.nameEn.includes("Retail") || job.nameEn.includes("Sales")) { characterModifier = 1.3; // 30% better for customer-facing roles characterBonus = currentLanguage === 'spanish' ? " Tu apariencia relajada y amigable es perfecta para este trabajo." : " Your relaxed and friendly appearance is perfect for this role."; } else if (job.salary >= 5000) { characterModifier = 0.9; // 10% worse for very high-level jobs characterBonus = currentLanguage === 'spanish' ? " El empleador prefiere una apariencia más formal." : " The employer prefers a more formal appearance."; } else { characterModifier = 1.0; // Neutral for other jobs } break; case 'maleWorkerSprite': // Worker male appearance is excellent for blue-collar and physical jobs if (job.nameEn.includes("Warehouse") || job.nameEn.includes("Security") || job.nameEn.includes("Delivery") || job.nameEn.includes("Driver") || job.salary <= 2500) { characterModifier = 1.4; // 40% better for blue-collar jobs characterBonus = currentLanguage === 'spanish' ? " Tu apariencia de trabajador es exactamente lo que buscan." : " Your working man appearance is exactly what they're looking for."; } else if (job.salary >= 4000) { characterModifier = 0.7; // 30% worse for white-collar jobs characterBonus = currentLanguage === 'spanish' ? " El empleador busca una apariencia más corporativa." : " The employer is looking for a more corporate appearance."; } else { characterModifier = 1.0; // Neutral for mid-level jobs } break; case 'maleAthleticSprite': // Athletic male appearance is great for sports, security, and physical jobs if (job.nameEn.includes("Warehouse") || job.nameEn.includes("Security") || job.nameEn.includes("Delivery") || job.nameEn.includes("Driver")) { characterModifier = 1.45; // 45% better for physical jobs characterBonus = currentLanguage === 'spanish' ? " Tu físico atlético es perfecto para este trabajo demandante." : " Your athletic physique is perfect for this demanding job."; } else if (job.nameEn.includes("Customer") || job.nameEn.includes("Sales")) { characterModifier = 1.15; // 15% better for customer roles (confidence boost) characterBonus = currentLanguage === 'spanish' ? " Tu confianza atlética impresiona a los clientes." : " Your athletic confidence impresses customers."; } else if (job.salary >= 5000) { characterModifier = 0.85; // 15% worse for high-level office jobs characterBonus = currentLanguage === 'spanish' ? " El empleador prefiere una apariencia más corporativa." : " The employer prefers a more corporate appearance."; } else { characterModifier = 1.0; // Neutral for other jobs } break; case 'basicCharacterSprite': default: // Basic appearance is neutral - no modifiers characterModifier = 1.0; break; } // Apply character modifier to hire chance actualHireChance = Math.min(0.95, actualHireChance * characterModifier); // Cap at 95% // If player was homeless and doesn't have at least $1,000,000, make jobs nearly impossible if (isHomeless && playerMoney < 1000000) { actualHireChance = 0.05; // Only 5% chance for any job when homeless without million dollars eventText.setText(currentLanguage === 'spanish' ? "El empleador nota tu historial de vagabundismo y parece reacio a contratarte. Necesitas demostrar estabilidad financiera primero." : "The employer notices your homeless background and seems reluctant to hire you. You need to prove financial stability first."); } // Use modified hiring probability if (chance < actualHireChance) { playerJob = getJobName(job); playerSalary = job.salary; playerHappiness += job.happiness; monthsUnemployed = 0; // If homeless player gets a job with million+ dollars, they can escape homelessness if (isHomeless && playerMoney >= 1000000) { isHomeless = false; storage.isHomeless = false; eventText.setText(getText('congratsJob') + getJobName(job) + "! " + (currentLanguage === 'spanish' ? "¡Tu estabilidad financiera te ha ayudado a escapar de la vida sin hogar!" : "Your financial stability has helped you escape homelessness!") + characterBonus); } else { eventText.setText(getText('congratsJob') + getJobName(job) + "!" + characterBonus); } playSound('success'); } else { if (isHomeless && playerMoney < 1000000) { eventText.setText(currentLanguage === 'spanish' ? "No conseguiste el trabajo. Los empleadores dudan de contratar a alguien sin hogar sin estabilidad financiera demostrada." : "You didn't get the job. Employers hesitate to hire someone homeless without proven financial stability."); } else { var rejectionMessage = getText('noJob'); // Add character-specific rejection feedback for negative modifiers if (characterModifier < 1.0 && characterBonus !== "") { rejectionMessage += characterBonus; } eventText.setText(rejectionMessage); } playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); } function showGambling() { currentScene = "gambling"; eventText.setText(getText('gamblingMenu')); clearChoices(); // Lottery ticket option addChoice(getText('lottery'), function () { if (playerMoney < 50) { eventText.setText(getText('notEnoughMoneyGamble')); clearChoices(); addChoice(getText('goBack'), function () { showMainMenu(); }); return; } playerMoney -= 50; var chance = Math.random(); if (chance < 0.3) { // 30% chance to win var winAmount = Math.floor(Math.random() * 300) + 100; // Win $100-$400 playerMoney += winAmount; playerHappiness += 15; eventText.setText(getText('gamblingWin') + winAmount + "!"); playSound('success'); } else { playerHappiness -= 5; eventText.setText(getText('gamblingLose')); playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); // Casino option addChoice(getText('casino'), function () { if (playerMoney < 100) { eventText.setText(getText('notEnoughMoneyGamble')); clearChoices(); addChoice(getText('goBack'), function () { showMainMenu(); }); return; } playerMoney -= 100; var chance = Math.random(); if (chance < 0.25) { // 25% chance to win var winAmount = Math.floor(Math.random() * 500) + 200; // Win $200-$700 playerMoney += winAmount; playerHappiness += 20; eventText.setText(getText('gamblingWin') + winAmount + "!"); playSound('success'); } else { playerHappiness -= 10; eventText.setText(getText('gamblingLose')); playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); // Sports betting option addChoice(getText('sportsBet'), function () { if (playerMoney < 75) { eventText.setText(getText('notEnoughMoneyGamble')); clearChoices(); addChoice(getText('goBack'), function () { showMainMenu(); }); return; } playerMoney -= 75; var chance = Math.random(); if (chance < 0.35) { // 35% chance to win var winAmount = Math.floor(Math.random() * 250) + 150; // Win $150-$400 playerMoney += winAmount; playerHappiness += 12; eventText.setText(getText('gamblingWin') + winAmount + "!"); playSound('success'); } else { playerHappiness -= 8; eventText.setText(getText('gamblingLose')); playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); addChoice(getText('goBack'), function () { showMainMenu(); }); } function showDating() { currentScene = "dating"; var person = relationships[Math.floor(Math.random() * relationships.length)]; eventText.setText(currentLanguage === 'spanish' ? "Conoces a " + getPersonName(person) + " en un café local. ¡Parece interesante!" : "You meet " + getPersonName(person) + " at a local cafe. They seem interesting!"); clearChoices(); addChoice(getText('askOut'), function () { if (playerMoney < 100) { eventText.setText(getText('notEnoughMoney')); clearChoices(); addChoice(getText('goBack'), function () { showMainMenu(); }); return; } playerMoney -= 100; var success = Math.random() > 0.4; if (success) { playerHappiness += person.happiness; var relationshipTerm = playerGender === 'male' ? getText('girlfriend') : getText('boyfriend'); // Get gender-specific person name based on player gender and person type var personName = getPersonName(person); // For gym partner, adjust the name based on player gender if (person.nameEn === "Gym Partner") { if (playerGender === 'male') { personName = currentLanguage === 'spanish' ? "Compañera de Gimnasio" : "Gym Partner"; } else { personName = currentLanguage === 'spanish' ? "Compañero de Gimnasio" : "Gym Partner"; } } playerRelationship = relationshipTerm + ": " + personName; eventText.setText(getText('wonderfulTime')); playSound('success'); } else { playerHappiness -= 5; eventText.setText(getText('dateNotWell')); playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); addChoice(getText('justFriends'), function () { playerHappiness += 3; eventText.setText(getText('friendlyChat')); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); addChoice(getText('goBack'), function () { showMainMenu(); }); } function advanceDay() { dayCounter++; // Age advancement (every 365 days = 1 year) if (dayCounter % 365 === 0) { playerAge++; storage.playerAge = playerAge; eventText.setText(getText('ageAdvanced') + " " + playerAge + " " + getText('yearsOld') + "!"); clearChoices(); addChoice(getText('continue'), function () { checkAgeAndHealthGameOver(); }); return; } // Daily health effects based on nutrition if (playerNutrition < 30) { playerHealth = Math.max(0, playerHealth - 0.5); } else if (playerNutrition > 70) { playerHealth = Math.min(100, playerHealth + 0.2); } // Age-related health decline if (playerAge > 60) { var healthDecline = (playerAge - 60) * 0.1; playerHealth = Math.max(0, playerHealth - healthDecline); } // Nutrition naturally decreases over time playerNutrition = Math.max(0, playerNutrition - 1); // Save health and nutrition to storage storage.playerHealth = playerHealth; storage.playerNutrition = playerNutrition; // Monthly salary if (dayCounter % 30 === 0 && playerJob !== getText('unemployed')) { var netSalary = playerSalary - monthlyChildExpenses; playerMoney += netSalary; var salaryText = getText('payday') + playerSalary; if (monthlyChildExpenses > 0) { salaryText += currentLanguage === 'spanish' ? " (Gastos de hijos: -$" + monthlyChildExpenses + ")" : " (Child expenses: -$" + monthlyChildExpenses + ")"; } salaryText += currentLanguage === 'spanish' ? " de tu trabajo como " + playerJob : " from your job as " + playerJob; eventText.setText(salaryText); clearChoices(); addChoice(getText('continue'), function () { checkDailyEvents(); }); return; } // Track unemployment if (playerJob === "Unemployed") { monthsUnemployed++; } // Random events (10% chance for regular events, 0.5% chance for special events) var eventChance = Math.random(); if (eventChance < 0.005) { showSpecialEvent(); } else if (eventChance < 0.105) { showRandomEvent(); } else { checkDailyEvents(); } } function showSpecialEvent() { var specialEvents = [{ type: "headhunter", chance: 0.3 }, { type: "inheritance", chance: 0.2 }, { type: "scholarship", chance: 0.2 }, { type: "business", chance: 0.15 }, { type: "celebrity", chance: 0.1 }, { type: "contest", chance: 0.05 }]; var eventType = specialEvents[Math.floor(Math.random() * specialEvents.length)].type; switch (eventType) { case "headhunter": eventText.setText(getText('headhunterOffer')); clearChoices(); addChoice(getText('acceptOffer'), function () { playerJob = "Executive"; playerSalary = 5500; playerHappiness += 25; playerMoney += 1000; // Signing bonus monthsUnemployed = 0; eventText.setText(getText('jobOfferAccepted')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); addChoice(getText('declineOffer'), function () { playerHappiness += 5; // Feel good about being selective eventText.setText(getText('jobOfferDeclined')); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); break; case "inheritance": playerMoney += 3000; playerHappiness += 20; eventText.setText(getText('inheritanceMoney')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); break; case "scholarship": playerMoney += 2500; playerHappiness += 15; eventText.setText(getText('scholarshipOffer')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); break; case "business": if (playerMoney >= 1000) { eventText.setText(getText('businessOpportunity')); clearChoices(); addChoice(getText('investInBusiness'), function () { playerMoney -= 1000; var success = Math.random() > 0.4; // 60% chance of success if (success) { playerMoney += 2500; playerHappiness += 30; eventText.setText(getText('businessSuccess')); playSound('success'); } else { playerHappiness -= 15; eventText.setText(getText('businessFailure')); playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); addChoice(getText('skipInvestment'), function () { eventText.setText(getText('jobOfferDeclined')); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); }); } else { // Fallback to celebrity event if not enough money playerMoney += 800; playerHappiness += 12; eventText.setText(getText('celebrityEncounter')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); } break; case "celebrity": playerMoney += 800; playerHappiness += 12; eventText.setText(getText('celebrityEncounter')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); break; case "contest": playerMoney += 1200; playerHappiness += 18; eventText.setText(getText('contestWin')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); break; } } function showRandomEvent() { var events = [{ textEn: "You found $50 on the street!", textEs: "¡Encontraste $50 en la calle!", money: 50, happiness: 5 }, { textEn: "Your car broke down. Repair costs $300.", textEs: "Tu auto se descompuso. Los costos de reparación son $300.", money: -300, happiness: -10 }, { textEn: "You won a small lottery prize of $200!", textEs: "¡Ganaste un pequeño premio de lotería de $200!", money: 200, happiness: 15 }, { textEn: "You got sick and had to pay $150 for medicine.", textEs: "Te enfermaste y tuviste que pagar $150 por medicina.", money: -150, happiness: -5 }]; var event = events[Math.floor(Math.random() * events.length)]; playerMoney = Math.max(0, playerMoney + event.money); playerHappiness = Math.max(0, Math.min(100, playerHappiness + event.happiness)); eventText.setText(currentLanguage === 'spanish' ? event.textEs : event.textEn); clearChoices(); addChoice(getText('continue'), function () { checkDailyEvents(); }); } function showExtrasMenu() { currentScene = "extras"; eventText.setText(currentLanguage === 'spanish' ? "Opciones adicionales:" : "Additional options:"); clearChoices(); addChoice(currentLanguage === 'spanish' ? "Datos del jugador" : "Player data", function () { showPlayerDataMenu(); }); addChoice(currentLanguage === 'spanish' ? "Ver estadísticas detalladas" : "View detailed stats", function () { showDetailedStats(); }); addChoice(currentLanguage === 'spanish' ? "Configurar dificultad" : "Configure difficulty", function () { showDifficultySettings(); }); addChoice(getText('customizeCharacter'), function () { showCharacterCustomization(); }); addChoice(currentLanguage === 'spanish' ? "Modo vagabundo" : "Homeless mode", function () { showHomelessModeMenu(); }); addChoice(currentLanguage === 'spanish' ? "Reiniciar juego" : "Reset game", function () { resetGame(); }); addChoice(getText('lifeOptions'), function () { showLifeOptionsMenu(); }); addChoice(getText('goBack'), function () { showMainMenu(); }); } function showPlayerDataMenu() { currentScene = "playerData"; eventText.setText(currentLanguage === 'spanish' ? "Datos del Jugador:" : "Player Data:"); clearChoices(); // Create temporary displays for player data if they don't exist if (!ageDisplay) { ageDisplay = game.addChild(new StatDisplay(getText('age'), playerAge, 0x9b59b6)); ageDisplay.x = 224; ageDisplay.y = 650; ageDisplay.updateValue(playerAge, ""); } if (!healthDisplay) { healthDisplay = game.addChild(new StatDisplay(getText('health'), playerHealth + "%", 0xe74c3c)); healthDisplay.x = 224; healthDisplay.y = 750; healthDisplay.updateValue(playerHealth + "%", ""); } if (!nutritionDisplay) { nutritionDisplay = game.addChild(new StatDisplay(getText('nutrition'), playerNutrition + "%", 0x2ecc71)); nutritionDisplay.x = 224; nutritionDisplay.y = 850; nutritionDisplay.updateValue(playerNutrition + "%", ""); } // Show displays ageDisplay.alpha = 1; healthDisplay.alpha = 1; nutritionDisplay.alpha = 1; addChoice(getText('goBack'), function () { // Hide displays when going back if (ageDisplay) ageDisplay.alpha = 0; if (healthDisplay) healthDisplay.alpha = 0; if (nutritionDisplay) nutritionDisplay.alpha = 0; showExtrasMenu(); }); } function showDetailedStats() { var yearsLived = Math.floor((dayCounter - 1) / 365); var daysInCurrentYear = (dayCounter - 1) % 365; var statsText = currentLanguage === 'spanish' ? "Estadísticas detalladas:\n\nDía: " + dayCounter + "\nEdad: " + playerAge + " años\nSalud: " + Math.floor(playerHealth) + "%\nNutrición: " + Math.floor(playerNutrition) + "%\nMeses desempleado: " + monthsUnemployed + "\nAños vividos: " + yearsLived + "\nDías en el año actual: " + daysInCurrentYear : "Detailed statistics:\n\nDay: " + dayCounter + "\nAge: " + playerAge + " years\nHealth: " + Math.floor(playerHealth) + "%\nNutrition: " + Math.floor(playerNutrition) + "%\nMonths unemployed: " + monthsUnemployed + "\nYears lived: " + yearsLived + "\nDays in current year: " + daysInCurrentYear; eventText.setText(statsText); clearChoices(); addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function showDifficultySettings() { eventText.setText(currentLanguage === 'spanish' ? "Configurar dificultad del juego:" : "Configure game difficulty:"); clearChoices(); addChoice(currentLanguage === 'spanish' ? "Fácil (más dinero)" : "Easy (more money)", function () { playerMoney += 500; eventText.setText(currentLanguage === 'spanish' ? "Dificultad configurada a Fácil. ¡Recibiste $500 extra!" : "Difficulty set to Easy. You received $500 bonus!"); clearChoices(); addChoice(getText('continue'), function () { showExtrasMenu(); }); }); addChoice(currentLanguage === 'spanish' ? "Difícil (menos dinero)" : "Hard (less money)", function () { playerMoney = Math.max(0, playerMoney - 200); playerHappiness += 10; eventText.setText(currentLanguage === 'spanish' ? "Dificultad configurada a Difícil. Perdiste $200 pero ganaste experiencia (+10 felicidad)." : "Difficulty set to Hard. You lost $200 but gained experience (+10 happiness)."); clearChoices(); addChoice(getText('continue'), function () { showExtrasMenu(); }); }); addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function showLifeOptionsMenu() { currentScene = "lifeOptions"; eventText.setText(getText('lifeOptions') + ":"); clearChoices(); // Health & Nutrition Section addChoice(currentLanguage === 'spanish' ? "🍎 Salud y Nutrición" : "🍎 Health & Nutrition", function () { showHealthNutritionMenu(); }); // Family & Home Section addChoice(currentLanguage === 'spanish' ? "🏠 Familia y Hogar" : "🏠 Family & Home", function () { showFamilyHomeMenu(); }); // Personal Items Section addChoice(currentLanguage === 'spanish' ? "💎 Pertenencias Personales" : "💎 Personal Belongings", function () { showPersonalItemsMenu(); }); addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function showHealthNutritionMenu() { currentScene = "healthNutrition"; eventText.setText(currentLanguage === 'spanish' ? "Opciones de Salud y Nutrición:" : "Health & Nutrition Options:"); clearChoices(); addChoice(getText('eatHealthy'), function () { playerNutrition = Math.min(100, playerNutrition + 20); playerHealth = Math.min(100, playerHealth + 5); playerMoney -= 80; // Healthy food costs more clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); }); addChoice(getText('eatJunk'), function () { playerNutrition = Math.min(100, playerNutrition + 5); playerHealth = Math.max(0, playerHealth - 2); playerMoney -= 30; // Junk food is cheaper clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); }); addChoice(getText('exercise'), function () { playerHealth = Math.min(100, playerHealth + 10); playerHappiness = Math.min(100, playerHappiness + 5); playerMoney -= 40; // Gym membership or equipment costs clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); }); addChoice(getText('rest'), function () { playerHealth = Math.min(100, playerHealth + 15); playerMoney -= 200; // Medical checkup cost clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); }); addChoice(getText('goBack'), function () { showLifeOptionsMenu(); }); } function showFamilyHomeMenu() { currentScene = "familyHome"; eventText.setText(currentLanguage === 'spanish' ? "Opciones de Familia y Hogar:" : "Family & Home Options:"); clearChoices(); addChoice(getText('findHouse'), function () { showFindHouse(); }); addChoice(getText('haveChildren'), function () { showHaveChildren(); }); addChoice(getText('visitParents'), function () { showVisitParents(); }); addChoice(getText('goBack'), function () { showLifeOptionsMenu(); }); } function showPersonalItemsMenu() { currentScene = "personalItems"; eventText.setText(currentLanguage === 'spanish' ? "Opciones de Pertenencias Personales:" : "Personal Belongings Options:"); clearChoices(); addChoice(getText('viewBelongings'), function () { showBelongingsMenu(); }); addChoice(getText('sellItems'), function () { showSellItems(); }); addChoice(getText('goBack'), function () { showLifeOptionsMenu(); }); } function showSellItems() { var itemsValue = Math.floor(Math.random() * 800) + 200; playerMoney += itemsValue; playerHappiness -= 5; eventText.setText(getText('soldBelongings') + itemsValue + "!"); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } function showFindHouse() { var housePrice = parseInt(getText('housePrice')); if (playerMoney >= housePrice) { playerMoney -= housePrice; playerHouse = true; storage.playerHouse = true; playerHappiness += 25; eventText.setText(getText('boughtHouse') + housePrice + "!"); playSound('success'); } else { eventText.setText(getText('notEnoughForHouse')); playSound('failure'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } function showHaveChildren() { if (playerRelationship === getText('single')) { eventText.setText(getText('needPartnerForChild')); playSound('failure'); } else { playerChildren++; storage.playerChildren = playerChildren; monthlyChildExpenses += parseInt(getText('childExpenses')); storage.monthlyChildExpenses = monthlyChildExpenses; playerHappiness += 20; eventText.setText(getText('hadChild')); playSound('success'); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } function showVisitParents() { playerHappiness += 15; eventText.setText(getText('visitedParents')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } function showBelongingsMenu() { currentScene = "belongings"; var belongingsText = getText('belongingsTitle') + ":\n\n"; // Show owned items var ownedCount = 0; for (var i = 0; i < shopItems.length; i++) { var item = shopItems[i]; if (playerBelongings[item.id]) { belongingsText += "✓ " + getText(item.nameKey) + "\n"; ownedCount++; } } if (ownedCount === 0) { belongingsText += currentLanguage === 'spanish' ? "No tienes pertenencias aún." : "You don't own any items yet."; } eventText.setText(belongingsText); clearChoices(); // Show available items to buy for (var i = 0; i < shopItems.length; i++) { var item = shopItems[i]; (function (itemData) { var buttonText = getText(itemData.nameKey) + " - $" + itemData.price; var canBuy = !playerBelongings[itemData.id] && playerMoney >= itemData.price; if (playerBelongings[itemData.id]) { buttonText += " (" + getText('alreadyOwn') + ")"; } else if (playerMoney < itemData.price) { buttonText += " (" + getText('cannotAfford') + ")"; } addChoice(buttonText, function () { if (playerBelongings[itemData.id]) { eventText.setText(currentLanguage === 'spanish' ? "Ya tienes este artículo." : "You already own this item."); clearChoices(); addChoice(getText('goBack'), function () { showBelongingsMenu(); }); } else if (playerMoney < itemData.price) { eventText.setText(currentLanguage === 'spanish' ? "No tienes suficiente dinero para comprar esto." : "You don't have enough money to buy this."); clearChoices(); addChoice(getText('goBack'), function () { showBelongingsMenu(); }); } else { playerMoney -= itemData.price; playerHappiness = Math.min(100, playerHappiness + itemData.happiness); playerBelongings[itemData.id] = true; storage.playerBelongings = playerBelongings; eventText.setText(getText('purchaseSuccess') + getText(itemData.nameKey) + "! +" + itemData.happiness + " " + getText('happiness')); playSound('success'); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } }); })(item); } addChoice(getText('goBack'), function () { showLifeOptionsMenu(); }); } function resetGame() { eventText.setText(currentLanguage === 'spanish' ? "¿Estás seguro de que quieres reiniciar el juego?" : "Are you sure you want to reset the game?"); clearChoices(); addChoice(currentLanguage === 'spanish' ? "Sí, reiniciar" : "Yes, reset", function () { // Reset all game variables playerMoney = 1000; playerJob = "Unemployed"; playerSalary = 0; playerHappiness = 50; playerRelationship = getText('single'); playerAge = 22; playerHealth = 100; playerNutrition = 50; monthsUnemployed = 0; dayCounter = 1; currentScene = "main"; playerHouse = false; playerChildren = 0; monthlyChildExpenses = 0; playerBelongings = {}; isHomeless = false; storage.language = currentLanguage; storage.gender = playerGender; storage.playerAge = 22; storage.playerHealth = 100; storage.playerNutrition = 50; storage.playerHouse = false; storage.playerChildren = 0; storage.monthlyChildExpenses = 0; storage.playerBelongings = {}; storage.isHomeless = false; currentCharacterSprite = 'basicCharacterSprite'; storage.characterSprite = 'basicCharacterSprite'; // Update character display if (characterDisplay) { characterDisplay.destroy(); } characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, { anchorX: 0.5, anchorY: 0.5, x: 1650, y: 400 })); characterDisplay.scaleX = 0.8; characterDisplay.scaleY = 0.8; updateUILanguage(); showMainMenu(); }); addChoice(currentLanguage === 'spanish' ? "No, cancelar" : "No, cancel", function () { showExtrasMenu(); }); } function checkAgeAndHealthGameOver() { updateStats(); if (checkGameOver()) { return; } checkDailyEvents(); } function showCharacterCustomization() { currentScene = "characterCustomization"; eventText.setText(getText('selectCharacterSprite')); clearChoices(); var characterOptions = []; // Add appropriate character options based on gender if (playerGender === 'male') { characterOptions = [{ id: 'businessCharacterSprite', nameKey: 'businessCharacter', color: 0x2c3e50 }, { id: 'maleExecutiveSprite', nameKey: 'maleExecutive', color: 0x34495e }, { id: 'maleCasualSprite', nameKey: 'maleCasual', color: 0x3498db }, { id: 'maleWorkerSprite', nameKey: 'maleWorker', color: 0x95a5a6 }, { id: 'maleAthleticSprite', nameKey: 'maleAthletic', color: 0xe67e22 }, { id: 'basicCharacterSprite', nameKey: 'basicCharacter', color: 0x8e44ad }]; } else if (playerGender === 'female') { characterOptions = [{ id: 'artisticCharacterSprite', nameKey: 'artisticCharacter', color: 0xe74c3c }, { id: 'casualCharacterSprite', nameKey: 'casualCharacter', color: 0x27ae60 }, { id: 'sportCharacterSprite', nameKey: 'sportCharacter', color: 0xf39c12 }, { id: 'basicCharacterSprite', nameKey: 'basicCharacter', color: 0x8e44ad }]; } else { // Default options for undefined gender characterOptions = [{ id: 'basicCharacterSprite', nameKey: 'basicCharacter', color: 0x8e44ad }, { id: 'businessCharacterSprite', nameKey: 'businessCharacter', color: 0x2c3e50 }, { id: 'casualCharacterSprite', nameKey: 'casualCharacter', color: 0x27ae60 }, { id: 'artisticCharacterSprite', nameKey: 'artisticCharacter', color: 0xe74c3c }, { id: 'sportCharacterSprite', nameKey: 'sportCharacter', color: 0xf39c12 }]; } for (var i = 0; i < characterOptions.length; i++) { var character = characterOptions[i]; (function (charData) { var isSelected = currentCharacterSprite === charData.id; var buttonText = getText(charData.nameKey) + (isSelected ? " ✓" : ""); addChoice(buttonText, function () { currentCharacterSprite = charData.id; storage.characterSprite = charData.id; // Update character display if (characterDisplay) { characterDisplay.destroy(); } characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, { anchorX: 0.5, anchorY: 0.5, x: 1650, y: 400 })); characterDisplay.scaleX = 0.8; characterDisplay.scaleY = 0.8; eventText.setText(getText('characterChanged')); playSound('buttonClick'); clearChoices(); addChoice(getText('continue'), function () { showCharacterCustomization(); }); }); })(character); } addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function showHomelessModeMenu() { currentScene = "homeless"; eventText.setText(currentLanguage === 'spanish' ? "Modo Vagabundo - Juega como una persona sin hogar:" : "Homeless Mode - Play as a homeless person:"); clearChoices(); addChoice(currentLanguage === 'spanish' ? "Comenzar como vagabundo" : "Start as homeless", function () { // Reset player to homeless state playerMoney = 0; playerJob = "Unemployed"; playerSalary = 0; playerHappiness = 20; playerRelationship = getText('single'); playerHouse = false; playerHealth = Math.max(30, playerHealth - 30); playerNutrition = Math.max(10, playerNutrition - 40); // Mark player as homeless in storage - this will make returning to normal life extremely difficult storage.isHomeless = true; storage.playerHouse = false; storage.playerHealth = playerHealth; storage.playerNutrition = playerNutrition; eventText.setText(currentLanguage === 'spanish' ? "Ahora eres una persona sin hogar. Debes sobrevivir en las calles. Tu salud y nutrición han disminuido. ADVERTENCIA: Será extremadamente difícil volver a la vida normal." : "You are now homeless. You must survive on the streets. Your health and nutrition have decreased. WARNING: It will be extremely difficult to return to normal life."); clearChoices(); addChoice(getText('continue'), function () { updateStats(); showHomelessMenu(); }); }); addChoice(currentLanguage === 'spanish' ? "Opciones de supervivencia" : "Survival options", function () { showHomelessMenu(); }); addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function showHomelessMenu() { currentScene = "homelessSurvival"; eventText.setText(currentLanguage === 'spanish' ? "Opciones de supervivencia en las calles:" : "Street survival options:"); clearChoices(); addChoice(currentLanguage === 'spanish' ? "Buscar comida en basureros" : "Search for food in dumpsters", function () { var foodFound = Math.random() > 0.5; if (foodFound) { playerNutrition = Math.min(100, playerNutrition + 15); playerHealth = Math.max(0, playerHealth - 5); // Risk of getting sick playerHappiness = Math.max(0, playerHappiness - 5); eventText.setText(currentLanguage === 'spanish' ? "Encontraste algo de comida, pero no estaba muy fresca. +15 nutrición, -5 salud, -5 felicidad." : "You found some food, but it wasn't very fresh. +15 nutrition, -5 health, -5 happiness."); } else { playerHappiness = Math.max(0, playerHappiness - 10); eventText.setText(currentLanguage === 'spanish' ? "No encontraste nada útil. Tu moral está baja. -10 felicidad." : "You didn't find anything useful. Your morale is low. -10 happiness."); } clearChoices(); addChoice(getText('continue'), function () { advanceDay(); }); }); addChoice(currentLanguage === 'spanish' ? "Pedir dinero en la calle" : "Ask for money on the street", function () { var moneyReceived = Math.floor(Math.random() * 20) + 5; playerMoney += moneyReceived; playerHappiness = Math.max(0, playerHappiness - 3); eventText.setText(currentLanguage === 'spanish' ? "Algunas personas te dieron algo de dinero. Recibiste $" + moneyReceived + ". -3 felicidad por la humillación." : "Some people gave you some money. You received $" + moneyReceived + ". -3 happiness from humiliation."); clearChoices(); addChoice(getText('continue'), function () { advanceDay(); }); }); addChoice(currentLanguage === 'spanish' ? "Dormir en refugio" : "Sleep in shelter", function () { if (playerMoney >= 10) { playerMoney -= 10; playerHealth = Math.min(100, playerHealth + 10); playerHappiness = Math.min(100, playerHappiness + 5); eventText.setText(currentLanguage === 'spanish' ? "Pasaste la noche en un refugio. Te sientes mejor. -$10, +10 salud, +5 felicidad." : "You spent the night in a shelter. You feel better. -$10, +10 health, +5 happiness."); } else { playerHealth = Math.max(0, playerHealth - 15); playerHappiness = Math.max(0, playerHappiness - 10); eventText.setText(currentLanguage === 'spanish' ? "No tienes dinero para el refugio. Dormiste en la calle. -15 salud, -10 felicidad." : "You don't have money for shelter. You slept on the street. -15 health, -10 happiness."); } clearChoices(); addChoice(getText('continue'), function () { advanceDay(); }); }); addChoice(currentLanguage === 'spanish' ? "Buscar trabajo temporal" : "Look for temporary work", function () { var jobFound = Math.random() > 0.7; // 30% chance if (jobFound) { var payment = Math.floor(Math.random() * 50) + 30; playerMoney += payment; playerHappiness = Math.min(100, playerHappiness + 15); playerHealth = Math.max(0, playerHealth - 5); eventText.setText(currentLanguage === 'spanish' ? "Encontraste trabajo temporal por un día. Ganaste $" + payment + ". +15 felicidad, -5 salud por el trabajo duro." : "You found temporary work for a day. You earned $" + payment + ". +15 happiness, -5 health from hard work."); } else { playerHappiness = Math.max(0, playerHappiness - 8); eventText.setText(currentLanguage === 'spanish' ? "No encontraste trabajo. La gente te rechazó. -8 felicidad." : "You didn't find work. People rejected you. -8 happiness."); } clearChoices(); addChoice(getText('continue'), function () { advanceDay(); }); }); addChoice(currentLanguage === 'spanish' ? "Intentar conseguir ayuda social" : "Try to get social help", function () { var helpReceived = Math.random() > 0.6; // 40% chance if (helpReceived) { playerMoney += 100; playerHappiness = Math.min(100, playerHappiness + 20); playerNutrition = Math.min(100, playerNutrition + 25); eventText.setText(currentLanguage === 'spanish' ? "Recibiste ayuda de una organización benéfica. +$100, +20 felicidad, +25 nutrición." : "You received help from a charity organization. +$100, +20 happiness, +25 nutrition."); } else { playerHappiness = Math.max(0, playerHappiness - 5); eventText.setText(currentLanguage === 'spanish' ? "No pudiste obtener ayuda hoy. Los recursos están limitados. -5 felicidad." : "You couldn't get help today. Resources are limited. -5 happiness."); } clearChoices(); addChoice(getText('continue'), function () { advanceDay(); }); }); addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function checkDailyEvents() { updateStats(); if (checkGameOver()) { return; } showMainMenu(); } // Initialize the game if (showingLanguageMenu) { showLanguageMenu(); } else if (showingGenderMenu || playerGender === null) { showingGenderMenu = true; showGenderMenu(); } else { updateUILanguage(); showMainMenu(); }
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ChoiceButton = Container.expand(function (text, action) {
var self = Container.call(this);
// Add shadow layer
var buttonShadow = self.attachAsset('choiceButtonShadow', {
anchorX: 0.5,
anchorY: 0.5
});
buttonShadow.alpha = 0.3;
buttonShadow.x = 5;
buttonShadow.y = 5;
// Add main button background
var buttonBg = self.attachAsset('choiceButton', {
anchorX: 0.5,
anchorY: 0.5
});
// Add subtle glow effect
var buttonGlow = self.attachAsset('choiceButtonHover', {
anchorX: 0.5,
anchorY: 0.5
});
buttonGlow.alpha = 0;
buttonGlow.scaleX = 1.05;
buttonGlow.scaleY = 1.05;
var buttonText = new Text2(text, {
size: 45,
fill: 0xFFFFFF
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.action = action;
// Add hover effect
self.move = function (x, y, obj) {
tween(buttonGlow, {
alpha: 0.2
}, {
duration: 200
});
};
self.down = function (x, y, obj) {
try {
LK.getSound('buttonClick').play();
} catch (e) {
console.log("Sound error:", e);
}
// Enhanced press animation
tween(buttonBg, {
scaleX: 0.95,
scaleY: 0.95
}, {
duration: 100
});
tween(buttonShadow, {
x: 2,
y: 2,
alpha: 0.5
}, {
duration: 100
});
tween(buttonGlow, {
alpha: 0.4,
scaleX: 1.02,
scaleY: 1.02
}, {
duration: 100
});
if (self.action) {
self.action();
}
};
self.up = function (x, y, obj) {
tween(buttonBg, {
scaleX: 1,
scaleY: 1
}, {
duration: 100
});
tween(buttonShadow, {
x: 5,
y: 5,
alpha: 0.3
}, {
duration: 100
});
tween(buttonGlow, {
alpha: 0,
scaleX: 1.05,
scaleY: 1.05
}, {
duration: 200
});
};
return self;
});
var StatDisplay = Container.expand(function (label, value, color) {
var self = Container.call(this);
// Add glow background
var statGlow = self.attachAsset('statBarGlow', {
anchorX: 0,
anchorY: 0
});
statGlow.tint = color || 0x34495e;
statGlow.alpha = 0.3;
statGlow.x = -10;
statGlow.y = -5;
var statBg = self.attachAsset('statBar', {
anchorX: 0,
anchorY: 0
});
statBg.tint = color || 0x34495e;
// Add subtle inner glow
var innerGlow = self.attachAsset('statBar', {
anchorX: 0,
anchorY: 0
});
innerGlow.tint = 0xffffff;
innerGlow.alpha = 0.1;
innerGlow.scaleX = 0.98;
innerGlow.scaleY = 0.85;
innerGlow.x = 15;
innerGlow.y = 6;
var labelText = new Text2(label + ": $" + value, {
size: 40,
fill: 0xFFFFFF
});
labelText.anchor.set(0, 0.5);
labelText.x = 20;
labelText.y = 40;
self.addChild(labelText);
self.labelText = labelText; // Expose labelText property
self.updateValue = function (newValue, prefix) {
labelText.setText(label + ": " + (prefix || "$") + newValue);
// Add subtle pulse animation on value update
tween(statBg, {
scaleX: 1.05,
scaleY: 1.1
}, {
duration: 150,
onComplete: function onComplete() {
tween(statBg, {
scaleX: 1,
scaleY: 1
}, {
duration: 150
});
}
});
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a252f
});
/****
* Game Code
****/
// Sound playing wrapper function
function playSound(soundId) {
try {
var sound = LK.getSound(soundId);
if (sound && sound.play) {
sound.play();
}
} catch (e) {
console.log("Could not play sound:", soundId, e);
}
}
// Language and game state variables
var currentLanguage = storage.language || 'english';
var playerGender = storage.gender || null;
var showingLanguageMenu = true;
var showingGenderMenu = false;
var playerMoney = 1000;
var isHomeless = storage.isHomeless || false;
var playerJob = "Unemployed";
var playerSalary = 0;
var playerHappiness = 50;
var playerRelationship = "Single";
var playerAge = storage.playerAge || 22;
var playerHealth = storage.playerHealth || 100;
var playerNutrition = storage.playerNutrition || 50;
var maxAge = 150;
var minAge = 1;
var monthsUnemployed = 0;
var dayCounter = 1;
var currentScene = "main";
var playerHouse = storage.playerHouse || false;
var playerChildren = storage.playerChildren || 0;
var monthlyChildExpenses = storage.monthlyChildExpenses || 0;
var playerBelongings = storage.playerBelongings || {};
// Initialize character sprite based on gender if not already customized
var currentCharacterSprite = storage.characterSprite;
if (!currentCharacterSprite) {
if (storage.gender === 'male') {
currentCharacterSprite = 'businessCharacterSprite';
} else if (storage.gender === 'female') {
currentCharacterSprite = 'artisticCharacterSprite';
} else {
currentCharacterSprite = 'basicCharacterSprite';
}
storage.characterSprite = currentCharacterSprite;
}
var characterDisplay = null;
// Available items to purchase
var shopItems = [{
id: "economy_car",
nameKey: "economyCarName",
price: 8000,
happiness: 20,
description: "Reliable economy car"
}, {
id: "luxury_car",
nameKey: "luxuryCarName",
price: 25000,
happiness: 40,
description: "High-end luxury vehicle"
}, {
id: "sports_car",
nameKey: "sportsCarName",
price: 35000,
happiness: 50,
description: "Fast sports car"
}, {
id: "suv",
nameKey: "suvName",
price: 18000,
happiness: 30,
description: "Family SUV"
}, {
id: "motorcycle",
nameKey: "motorcycleName",
price: 5000,
happiness: 25,
description: "Speedy motorcycle"
}, {
id: "ring",
nameKey: "ringName",
price: 3000,
happiness: 15,
description: "An elegant diamond ring"
}, {
id: "playstation",
nameKey: "playstationName",
price: 500,
happiness: 20,
description: "Latest gaming console"
}, {
id: "laptop",
nameKey: "laptopName",
price: 2000,
happiness: 25,
description: "High-end gaming laptop"
}, {
id: "watch",
nameKey: "watchName",
price: 5000,
happiness: 18,
description: "Luxury timepiece"
}, {
id: "bike",
nameKey: "bikeName",
price: 800,
happiness: 12,
description: "Mountain bike for adventures"
}];
// Translations
var translations = {
english: {
title: "Life Simulator: Rise to Success",
selectLanguage: "Select Language / Seleccionar Idioma",
english: "English",
spanish: "Español",
selectGender: "Select your gender:",
male: "Male",
female: "Female",
girlfriend: "Girlfriend",
boyfriend: "Boyfriend",
money: "Money",
job: "Job",
happiness: "Happiness",
relationship: "Relationship",
unemployed: "Unemployed",
single: "Single",
welcome: "Welcome to your adult life! You're starting with $1000. What's your first move?",
dayText: "Day",
whatToDo: ": What would you like to do today?",
lookForJob: "Look for a job",
goOnDate: "Go on a date",
gamble: "Go gambling",
restAtHome: "Rest at home (+10 happiness)",
workExtra: "Work extra hours (+money)",
availableJobs: "Available job opportunities:",
goBack: "Go back",
congratsJob: "Congratulations! You got the job as ",
noJob: "Sorry, you didn't get the job. Better luck next time!",
needJobFirst: "You need a job first!",
"continue": "Continue",
askOut: "Ask them out ($100)",
justFriends: "Just be friends",
notEnoughMoney: "You don't have enough money for a proper date!",
wonderfulTime: "Great! You had a wonderful time together!",
dateNotWell: "The date didn't go well. Maybe next time!",
friendlyChat: "You had a nice friendly conversation!",
payday: "Payday! You received $",
gameOver: "You've run out of money and can't find work. You're forced to move back with your parents. Game Over!",
youWin: "Congratulations! You've achieved financial stability, happiness, and love. You've won at life!",
dating: "Dating ",
gamblingMenu: "Choose your gambling option:",
lottery: "Buy lottery ticket ($50)",
casino: "Go to casino ($100)",
sportsBet: "Sports betting ($75)",
gamblingWin: "Congratulations! You won $",
gamblingLose: "You lost your bet. Better luck next time!",
notEnoughMoneyGamble: "You don't have enough money to gamble!",
specialEventTitle: "Special Opportunity!",
headhunterOffer: "A headhunter contacts you with an exclusive job offer paying $5500/month! Do you accept?",
acceptOffer: "Accept the offer",
declineOffer: "Decline politely",
jobOfferAccepted: "Congratulations! You accepted the high-paying position!",
jobOfferDeclined: "You politely declined the offer. Maybe next time!",
inheritanceMoney: "You received an unexpected inheritance of $3000 from a distant relative!",
scholarshipOffer: "You've been offered a scholarship worth $2500! This will boost your qualifications.",
businessOpportunity: "A friend offers you a chance to invest $1000 in their startup. It could pay off big!",
investInBusiness: "Invest in the business",
skipInvestment: "Skip the investment",
businessSuccess: "Great news! Your investment paid off! You received $2500 back!",
businessFailure: "Unfortunately, the business failed and you lost your investment.",
celebrityEncounter: "You helped a celebrity and they gave you $800 as a thank you!",
contestWin: "You won a local contest and received $1200 in prize money!",
extras: "Extras",
sellItems: "Sell your belongings",
findHouse: "Look for a house",
haveChildren: "Have children",
visitParents: "Visit parents",
lifeOptions: "Life Options",
sellItemsDesc: "Sell what you own to get money",
findHouseDesc: "Search for a place to live",
haveChildrenDesc: "Start a family",
visitParentsDesc: "Spend time with family",
soldBelongings: "You sold your belongings for $",
boughtHouse: "Congratulations! You bought a house for $",
notEnoughForHouse: "You don't have enough money for a house!",
hadChild: "Congratulations! You had a child! Happiness +20, Monthly expenses +$300",
needPartnerForChild: "You need a partner to have children!",
visitedParents: "You had a wonderful time with your parents! Happiness +15",
housePrice: "8000",
childExpenses: "300",
viewBelongings: "View belongings",
viewBelongingsDesc: "See what you own and buy new items",
belongingsTitle: "Your Belongings & Shopping",
buyItem: "Buy",
alreadyOwn: "Already owned",
cannotAfford: "Cannot afford",
purchaseSuccess: "You bought a ",
economyCarName: "Economy Car",
luxuryCarName: "Luxury Car",
sportsCarName: "Sports Car",
suvName: "Family SUV",
motorcycleName: "Motorcycle",
ringName: "Diamond Ring",
playstationName: "PlayStation 5",
laptopName: "Gaming Laptop",
watchName: "Luxury Watch",
bikeName: "Mountain Bike",
age: "Age",
health: "Health",
nutrition: "Nutrition",
eatHealthy: "Eat healthy food (+20 nutrition, +5 health)",
eatJunk: "Eat junk food (+5 nutrition, -2 health)",
exercise: "Exercise (+10 health, +5 happiness)",
rest: "Get medical checkup (+15 health)",
ageAdvanced: "Happy Birthday! You are now",
yearsOld: "years old",
diedOfAge: "You lived a full life and passed away peacefully at age",
diedOfHealth: "Your poor health caught up with you. You passed away at age",
gameOverAge: "Game Over - You have reached the end of your natural life.",
gameOverHealth: "Game Over - Your health deteriorated beyond recovery.",
homelessMode: "Homeless Mode",
startHomeless: "Start as homeless",
survivalOptions: "Survival options",
searchFood: "Search for food in dumpsters",
askMoney: "Ask for money on the street",
sleepShelter: "Sleep in shelter",
tempWork: "Look for temporary work",
socialHelp: "Try to get social help",
customizeCharacter: "Customize character",
characterCustomization: "Character Customization",
selectCharacterSprite: "Select your character appearance:",
basicCharacter: "Basic Character",
businessCharacter: "Business Person",
casualCharacter: "Casual Person",
artisticCharacter: "Artistic Person",
sportCharacter: "Athletic Person",
maleExecutive: "Executive Man",
maleCasual: "Casual Man",
maleWorker: "Working Man",
maleAthletic: "Athletic Man",
characterChanged: "Your character appearance has been updated!"
},
spanish: {
title: "Simulador de Vida: Camino al Éxito",
selectLanguage: "Select Language / Seleccionar Idioma",
english: "English",
spanish: "Español",
selectGender: "Selecciona tu género:",
male: "Hombre",
female: "Mujer",
girlfriend: "Novia",
boyfriend: "Novio",
money: "Dinero",
job: "Trabajo",
happiness: "Felicidad",
relationship: "Relación",
unemployed: "Desempleado",
single: "Soltero",
welcome: "¡Bienvenido a tu vida adulta! Empiezas con $1000. ¿Cuál es tu primer movimiento?",
dayText: "Día",
whatToDo: ": ¿Qué te gustaría hacer hoy?",
lookForJob: "Buscar trabajo",
goOnDate: "Ir a una cita",
gamble: "Ir a apostar",
restAtHome: "Descansar en casa (+10 felicidad)",
workExtra: "Trabajar horas extra (+dinero)",
availableJobs: "Oportunidades de trabajo disponibles:",
goBack: "Volver",
congratsJob: "¡Felicidades! Conseguiste el trabajo como ",
noJob: "Lo siento, no conseguiste el trabajo. ¡Mejor suerte la próxima vez!",
needJobFirst: "¡Necesitas un trabajo primero!",
"continue": "Continuar",
askOut: "Invitarla/o a salir ($100)",
justFriends: "Solo ser amigos",
notEnoughMoney: "¡No tienes suficiente dinero para una cita apropiada!",
wonderfulTime: "¡Genial! ¡Pasaron un tiempo maravilloso juntos!",
dateNotWell: "La cita no fue bien. ¡Tal vez la próxima vez!",
friendlyChat: "¡Tuviste una conversación amistosa agradable!",
payday: "¡Día de pago! Recibiste $",
gameOver: "Te quedaste sin dinero y no puedes encontrar trabajo. Te ves obligado a regresar con tus padres. ¡Fin del juego!",
youWin: "¡Felicidades! Has logrado estabilidad financiera, felicidad y amor. ¡Has ganado en la vida!",
dating: "Saliendo con ",
gamblingMenu: "Elige tu opción de apuesta:",
lottery: "Comprar boleto de lotería ($50)",
casino: "Ir al casino ($100)",
sportsBet: "Apuestas deportivas ($75)",
gamblingWin: "¡Felicidades! Ganaste $",
gamblingLose: "Perdiste tu apuesta. ¡Mejor suerte la próxima vez!",
notEnoughMoneyGamble: "¡No tienes suficiente dinero para apostar!",
specialEventTitle: "¡Oportunidad Especial!",
headhunterOffer: "¡Un cazatalentos te contacta con una oferta de trabajo exclusiva que paga $5500/mes! ¿Aceptas?",
acceptOffer: "Aceptar la oferta",
declineOffer: "Declinar cortésmente",
jobOfferAccepted: "¡Felicidades! Aceptaste el puesto bien remunerado!",
jobOfferDeclined: "Declinaste cortésmente la oferta. ¡Tal vez la próxima vez!",
inheritanceMoney: "¡Recibiste una herencia inesperada de $3000 de un pariente lejano!",
scholarshipOffer: "¡Te han ofrecido una beca por valor de $2500! Esto mejorará tus calificaciones.",
businessOpportunity: "Un amigo te ofrece la oportunidad de invertir $1000 en su startup. ¡Podría dar grandes frutos!",
investInBusiness: "Invertir en el negocio",
skipInvestment: "Omitir la inversión",
businessSuccess: "¡Grandes noticias! ¡Tu inversión dio frutos! ¡Recibiste $2500 de vuelta!",
businessFailure: "Desafortunadamente, el negocio falló y perdiste tu inversión.",
celebrityEncounter: "¡Ayudaste a una celebridad y te dio $800 como agradecimiento!",
contestWin: "¡Ganaste un concurso local y recibiste $1200 en dinero del premio!",
extras: "Extras",
sellItems: "Vender tus pertenencias",
findHouse: "Buscar casa",
haveChildren: "Tener hijos",
visitParents: "Visitar padres",
lifeOptions: "Opciones de Vida",
sellItemsDesc: "Vende lo que tienes para obtener dinero",
findHouseDesc: "Busca un lugar donde vivir",
haveChildrenDesc: "Formar una familia",
visitParentsDesc: "Pasar tiempo con la familia",
soldBelongings: "Vendiste tus pertenencias por $",
boughtHouse: "¡Felicidades! Compraste una casa por $",
notEnoughForHouse: "¡No tienes suficiente dinero para una casa!",
hadChild: "¡Felicidades! Tuviste un hijo! Felicidad +20, Gastos mensuales +$300",
needPartnerForChild: "¡Necesitas una pareja para tener hijos!",
visitedParents: "¡Pasaste un tiempo maravilloso con tus padres! Felicidad +15",
housePrice: "8000",
childExpenses: "300",
viewBelongings: "Ver pertenencias",
viewBelongingsDesc: "Ve lo que tienes y compra nuevos artículos",
belongingsTitle: "Tus Pertenencias y Compras",
buyItem: "Comprar",
alreadyOwn: "Ya lo tienes",
cannotAfford: "No puedes permitirte",
purchaseSuccess: "Compraste un ",
economyCarName: "Auto Económico",
luxuryCarName: "Auto de Lujo",
sportsCarName: "Auto Deportivo",
suvName: "SUV Familiar",
motorcycleName: "Motocicleta",
ringName: "Anillo de Diamante",
playstationName: "PlayStation 5",
laptopName: "Laptop Gamer",
watchName: "Reloj de Lujo",
bikeName: "Bicicleta de Montaña",
age: "Edad",
health: "Salud",
nutrition: "Nutrición",
eatHealthy: "Comer comida saludable (+20 nutrición, +5 salud)",
eatJunk: "Comer comida chatarra (+5 nutrición, -2 salud)",
exercise: "Hacer ejercicio (+10 salud, +5 felicidad)",
rest: "Hacerse un chequeo médico (+15 salud)",
ageAdvanced: "¡Feliz Cumpleaños! Ahora tienes",
yearsOld: "años",
diedOfAge: "Viviste una vida plena y falleciste en paz a los",
diedOfHealth: "Tu mala salud te alcanzó. Falleciste a los",
gameOverAge: "Fin del Juego - Has llegado al final de tu vida natural.",
gameOverHealth: "Fin del Juego - Tu salud se deterioró sin posibilidad de recuperación.",
homelessMode: "Modo Vagabundo",
startHomeless: "Comenzar como vagabundo",
survivalOptions: "Opciones de supervivencia",
searchFood: "Buscar comida en basureros",
askMoney: "Pedir dinero en la calle",
sleepShelter: "Dormir en refugio",
tempWork: "Buscar trabajo temporal",
socialHelp: "Intentar conseguir ayuda social",
customizeCharacter: "Personalizar personaje",
characterCustomization: "Personalización del Personaje",
selectCharacterSprite: "Selecciona la apariencia de tu personaje:",
basicCharacter: "Personaje Básico",
businessCharacter: "Persona de Negocios",
casualCharacter: "Persona Casual",
artisticCharacter: "Persona Artística",
sportCharacter: "Persona Atlética",
maleExecutive: "Hombre Ejecutivo",
maleCasual: "Hombre Casual",
maleWorker: "Hombre Trabajador",
maleAthletic: "Hombre Atlético",
characterChanged: "¡La apariencia de tu personaje ha sido actualizada!"
}
};
function getText(key) {
return translations[currentLanguage][key] || key;
}
// Job data with translations and hiring probabilities
var availableJobs = [{
nameEn: "Fast Food Worker",
nameEs: "Trabajador de Comida Rápida",
salary: 1200,
requirements: "None",
happiness: -5,
hireChance: 0.85 // 85% chance - easy to get
}, {
nameEn: "Retail Associate",
nameEs: "Asociado de Ventas",
salary: 1400,
requirements: "None",
happiness: -3,
hireChance: 0.80 // 80% chance
}, {
nameEn: "Warehouse Worker",
nameEs: "Trabajador de Almacén",
salary: 1600,
requirements: "Physical Fitness",
happiness: -2,
hireChance: 0.75 // 75% chance
}, {
nameEn: "Delivery Driver",
nameEs: "Conductor de Entrega",
salary: 1800,
requirements: "Driver's License",
happiness: 2,
hireChance: 0.70 // 70% chance
}, {
nameEn: "Office Assistant",
nameEs: "Asistente de Oficina",
salary: 2000,
requirements: "High School",
happiness: 0,
hireChance: 0.65 // 65% chance
}, {
nameEn: "Customer Service Rep",
nameEs: "Representante de Servicio al Cliente",
salary: 2200,
requirements: "Communication Skills",
happiness: -1,
hireChance: 0.60 // 60% chance
}, {
nameEn: "Security Guard",
nameEs: "Guardia de Seguridad",
salary: 2400,
requirements: "Background Check",
happiness: 3,
hireChance: 0.55 // 55% chance
}, {
nameEn: "Bank Teller",
nameEs: "Cajero de Banco",
salary: 2800,
requirements: "Some Experience",
happiness: 5,
hireChance: 0.50 // 50% chance
}, {
nameEn: "Receptionist",
nameEs: "Recepcionista",
salary: 2600,
requirements: "Professional Appearance",
happiness: 4,
hireChance: 0.52 // 52% chance
}, {
nameEn: "Sales Associate",
nameEs: "Asociado de Ventas",
salary: 3000,
requirements: "Sales Experience",
happiness: 6,
hireChance: 0.45 // 45% chance
}, {
nameEn: "Administrative Assistant",
nameEs: "Asistente Administrativo",
salary: 3200,
requirements: "Office Skills",
happiness: 7,
hireChance: 0.42 // 42% chance
}, {
nameEn: "Bookkeeper",
nameEs: "Tenedor de Libros",
salary: 3500,
requirements: "Accounting Knowledge",
happiness: 8,
hireChance: 0.38 // 38% chance
}, {
nameEn: "Manager",
nameEs: "Gerente",
salary: 4200,
requirements: "Leadership Experience",
happiness: 10,
hireChance: 0.35 // 35% chance
}, {
nameEn: "Marketing Specialist",
nameEs: "Especialista en Marketing",
salary: 4500,
requirements: "Marketing Degree",
happiness: 12,
hireChance: 0.32 // 32% chance
}, {
nameEn: "Accountant",
nameEs: "Contador",
salary: 4800,
requirements: "Accounting Degree",
happiness: 11,
hireChance: 0.30 // 30% chance
}, {
nameEn: "Software Developer",
nameEs: "Desarrollador de Software",
salary: 5000,
requirements: "College Degree",
happiness: 15,
hireChance: 0.28 // 28% chance
}, {
nameEn: "Project Manager",
nameEs: "Gerente de Proyecto",
salary: 5500,
requirements: "Management Experience",
happiness: 13,
hireChance: 0.25 // 25% chance
}, {
nameEn: "Senior Developer",
nameEs: "Desarrollador Senior",
salary: 6000,
requirements: "5+ Years Experience",
happiness: 18,
hireChance: 0.22 // 22% chance
}, {
nameEn: "Data Analyst",
nameEs: "Analista de Datos",
salary: 5800,
requirements: "Statistics Knowledge",
happiness: 16,
hireChance: 0.24 // 24% chance
}, {
nameEn: "Engineering Manager",
nameEs: "Gerente de Ingeniería",
salary: 7000,
requirements: "Engineering Degree + Leadership",
happiness: 20,
hireChance: 0.18 // 18% chance
}, {
nameEn: "Senior Manager",
nameEs: "Gerente Senior",
salary: 7500,
requirements: "MBA + Experience",
happiness: 22,
hireChance: 0.15 // 15% chance
}, {
nameEn: "Director",
nameEs: "Director",
salary: 8500,
requirements: "Executive Experience",
happiness: 25,
hireChance: 0.12 // 12% chance
}, {
nameEn: "VP of Operations",
nameEs: "VP de Operaciones",
salary: 10000,
requirements: "Senior Leadership",
happiness: 28,
hireChance: 0.08 // 8% chance
}, {
nameEn: "CEO",
nameEs: "Director Ejecutivo",
salary: 15000,
requirements: "Extensive Leadership",
happiness: 35,
hireChance: 0.05 // 5% chance - very rare
}];
function getJobName(job) {
return currentLanguage === 'spanish' ? job.nameEs : job.nameEn;
}
var relationships = [{
nameEn: "Coffee Shop Regular",
nameEs: "Cliente Habitual del Café",
status: "Stranger",
happiness: 5
}, {
nameEn: "Gym Partner",
nameEs: "Compañero de Gimnasio",
status: "Acquaintance",
happiness: 8
}, {
nameEn: "Coworker",
nameEs: "Compañero de Trabajo",
status: "Friend",
happiness: 12
}];
function getPersonName(person) {
return currentLanguage === 'spanish' ? person.nameEs : person.nameEn;
}
// UI Elements - Enhanced with visual effects
// Add gradient background
var backgroundGradient = game.addChild(LK.getAsset('backgroundGradient', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
backgroundGradient.alpha = 0.8;
var backgroundPanel = game.addChild(LK.getAsset('backgroundPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Add subtle animation to background
tween(backgroundPanel, {
scaleX: 1.02,
scaleY: 1.02
}, {
duration: 3000,
yoyo: true,
repeat: -1
});
// Enhanced title with background and glow
var titleBackground = game.addChild(LK.getAsset('titleBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 190
}));
titleBackground.alpha = 0.8;
var titleText = new Text2(getText('selectLanguage'), {
size: 60,
fill: 0xFFFFFF
});
titleText.anchor.set(0.5, 0);
titleText.x = 1024;
titleText.y = 150;
game.addChild(titleText);
// Add subtle title animation
tween(titleText, {
y: 145
}, {
duration: 2000,
yoyo: true,
repeat: -1
});
// Stats display
var moneyDisplay = game.addChild(new StatDisplay(getText('money'), playerMoney, 0x27ae60));
moneyDisplay.x = 224;
moneyDisplay.y = 250;
var jobDisplay = game.addChild(new StatDisplay(getText('job'), getText('unemployed'), 0x8e44ad));
jobDisplay.x = 224;
jobDisplay.y = 350;
jobDisplay.updateValue(getText('unemployed'), "");
var happinessDisplay = game.addChild(new StatDisplay(getText('happiness'), playerHappiness + "%", 0xf39c12));
happinessDisplay.x = 224;
happinessDisplay.y = 450;
happinessDisplay.updateValue(playerHappiness + "%", "");
var relationshipDisplay = game.addChild(new StatDisplay(getText('relationship'), getText('single'), 0xe91e63));
relationshipDisplay.x = 224;
relationshipDisplay.y = 550;
relationshipDisplay.updateValue(getText('single'), "");
// Player data displays - will be shown in separate menu
var ageDisplay = null;
var healthDisplay = null;
var nutritionDisplay = null;
// Character display
characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, {
anchorX: 0.5,
anchorY: 0.5,
x: 1650,
y: 400
}));
characterDisplay.scaleX = 0.8;
characterDisplay.scaleY = 0.8;
// Event panel - Enhanced with glow effect
var eventPanelGlow = game.addChild(LK.getAsset('eventPanelGlow', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 690
}));
eventPanelGlow.alpha = 0.4;
var eventPanel = game.addChild(LK.getAsset('eventPanel', {
anchorX: 0.5,
anchorY: 0,
x: 1024,
y: 700
}));
// Add subtle breathing animation to event panel
tween(eventPanel, {
scaleX: 1.01,
scaleY: 1.01
}, {
duration: 4000,
yoyo: true,
repeat: -1
});
var eventText = new Text2(getText('selectLanguage'), {
size: 42,
fill: 0xFFFFFF
});
eventText.anchor.set(0.5, 0);
eventText.x = 1024;
eventText.y = 750;
game.addChild(eventText);
// Choice buttons
var choiceButtons = [];
function clearChoices() {
for (var i = 0; i < choiceButtons.length; i++) {
choiceButtons[i].destroy();
}
choiceButtons = [];
}
function addChoice(text, action) {
var button = new ChoiceButton(text, action);
button.x = 1024;
button.y = 1200 + choiceButtons.length * 140;
// Add entrance animation
button.alpha = 0;
button.scaleX = 0.8;
button.scaleY = 0.8;
game.addChild(button);
choiceButtons.push(button);
// Animate button entrance with staggered timing
tween(button, {
alpha: 1,
scaleX: 1,
scaleY: 1
}, {
duration: 300,
delay: choiceButtons.length * 50
});
}
function showLanguageMenu() {
titleText.setText(getText('selectLanguage'));
eventText.setText(getText('selectLanguage'));
clearChoices();
addChoice(getText('english'), function () {
currentLanguage = 'english';
storage.language = 'english';
showingLanguageMenu = false;
showingGenderMenu = true;
updateUILanguage();
showGenderMenu();
});
addChoice(getText('spanish'), function () {
currentLanguage = 'spanish';
storage.language = 'spanish';
showingLanguageMenu = false;
showingGenderMenu = true;
updateUILanguage();
showGenderMenu();
});
}
function showGenderMenu() {
titleText.setText(getText('title'));
eventText.setText(getText('selectGender'));
clearChoices();
addChoice(getText('male'), function () {
playerGender = 'male';
storage.gender = 'male';
playerRelationship = getText('single');
// Set default male character sprite
currentCharacterSprite = 'businessCharacterSprite';
storage.characterSprite = 'businessCharacterSprite';
// Update character display
if (characterDisplay) {
characterDisplay.destroy();
}
characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, {
anchorX: 0.5,
anchorY: 0.5,
x: 1650,
y: 400
}));
characterDisplay.scaleX = 0.8;
characterDisplay.scaleY = 0.8;
showingGenderMenu = false;
updateUILanguage();
showMainMenu();
});
addChoice(getText('female'), function () {
playerGender = 'female';
storage.gender = 'female';
playerRelationship = getText('single');
// Set default female character sprite
currentCharacterSprite = 'artisticCharacterSprite';
storage.characterSprite = 'artisticCharacterSprite';
// Update character display
if (characterDisplay) {
characterDisplay.destroy();
}
characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, {
anchorX: 0.5,
anchorY: 0.5,
x: 1650,
y: 400
}));
characterDisplay.scaleX = 0.8;
characterDisplay.scaleY = 0.8;
showingGenderMenu = false;
updateUILanguage();
showMainMenu();
});
}
function updateUILanguage() {
titleText.setText(getText('title'));
moneyDisplay.labelText.setText(getText('money') + ": $" + playerMoney);
jobDisplay.labelText.setText(getText('job') + ": " + (playerJob === "Unemployed" ? getText('unemployed') : playerJob));
happinessDisplay.labelText.setText(getText('happiness') + ": " + playerHappiness + "%");
relationshipDisplay.labelText.setText(getText('relationship') + ": " + (playerRelationship === "Single" ? getText('single') : playerRelationship));
if (ageDisplay) ageDisplay.labelText.setText(getText('age') + ": " + playerAge);
if (healthDisplay) healthDisplay.labelText.setText(getText('health') + ": " + playerHealth + "%");
if (nutritionDisplay) nutritionDisplay.labelText.setText(getText('nutrition') + ": " + playerNutrition + "%");
}
function updateStats() {
moneyDisplay.updateValue(playerMoney);
var jobText = playerJob === "Unemployed" ? getText('unemployed') : playerJob;
jobDisplay.updateValue(jobText, "");
happinessDisplay.updateValue(playerHappiness + "%", "");
var relationshipText = playerRelationship === "Single" ? getText('single') : playerRelationship;
relationshipDisplay.updateValue(relationshipText, "");
if (ageDisplay) ageDisplay.updateValue(playerAge, "");
if (healthDisplay) healthDisplay.updateValue(playerHealth + "%", "");
if (nutritionDisplay) nutritionDisplay.updateValue(playerNutrition + "%", "");
}
function checkGameOver() {
// Check age limit
if (playerAge >= maxAge) {
eventText.setText(getText('diedOfAge') + " " + playerAge + ". " + getText('gameOverAge'));
clearChoices();
playSound('failure');
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
return true;
}
// Check health
if (playerHealth <= 0) {
eventText.setText(getText('diedOfHealth') + " " + playerAge + ". " + getText('gameOverHealth'));
clearChoices();
playSound('failure');
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
return true;
}
// Check happiness - death from depression/suicide
if (playerHappiness <= 0) {
eventText.setText(currentLanguage === 'spanish' ? "Tu felicidad llegó a cero. La depresión te venció y falleciste a los " + playerAge + " años. Fin del Juego - La vida sin felicidad no puede continuar." : "Your happiness reached zero. Depression overcame you and you passed away at age " + playerAge + ". Game Over - Life without happiness cannot continue.");
clearChoices();
playSound('failure');
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
return true;
}
// Check combined low health and happiness - death from poor life conditions
if (playerHealth <= 10 && playerHappiness <= 10) {
eventText.setText(currentLanguage === 'spanish' ? "Tu mala salud combinada con muy baja felicidad resultó en tu muerte a los " + playerAge + " años. Fin del Juego - No pudiste mantener las condiciones básicas para vivir." : "Your poor health combined with very low happiness resulted in your death at age " + playerAge + ". Game Over - You couldn't maintain basic living conditions.");
clearChoices();
playSound('failure');
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
return true;
}
if (playerMoney <= 0 && monthsUnemployed >= 3) {
eventText.setText(getText('gameOver'));
clearChoices();
playSound('failure');
LK.setTimeout(function () {
LK.showGameOver();
}, 2000);
return true;
}
if (playerMoney >= 10000 && playerHappiness >= 80 && playerRelationship !== getText('single')) {
eventText.setText(getText('youWin'));
clearChoices();
playSound('success');
LK.setTimeout(function () {
LK.showYouWin();
}, 2000);
return true;
}
return false;
}
function showMainMenu() {
currentScene = "main";
eventText.setText(getText('dayText') + " " + dayCounter + getText('whatToDo'));
clearChoices();
addChoice(getText('lookForJob'), function () {
showJobSearch();
});
addChoice(getText('goOnDate'), function () {
showDating();
});
addChoice(getText('gamble'), function () {
showGambling();
});
addChoice(getText('restAtHome'), function () {
playerHappiness = Math.min(100, playerHappiness + 10);
playerMoney -= 50; // Daily expenses
advanceDay();
});
addChoice(getText('workExtra'), function () {
if (playerJob === "Unemployed") {
eventText.setText(getText('needJobFirst'));
return;
}
playerMoney += Math.floor(playerSalary * 0.3);
playerHappiness = Math.max(0, playerHappiness - 5);
playerMoney -= 50; // Daily expenses
advanceDay();
});
addChoice(getText('extras'), function () {
showExtrasMenu();
});
}
function showJobSearch() {
currentScene = "jobs";
eventText.setText(getText('availableJobs'));
clearChoices();
// Create a shuffled copy of available jobs and show random 4-6 jobs
var shuffledJobs = availableJobs.slice();
for (var i = shuffledJobs.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = shuffledJobs[i];
shuffledJobs[i] = shuffledJobs[j];
shuffledJobs[j] = temp;
}
var numJobsToShow = Math.floor(Math.random() * 3) + 4; // Show 4-6 jobs
for (var i = 0; i < Math.min(numJobsToShow, shuffledJobs.length); i++) {
var job = shuffledJobs[i];
(function (jobData) {
var chanceText = "";
if (jobData.hireChance >= 0.7) {
chanceText = currentLanguage === 'spanish' ? " (Alta probabilidad)" : " (High chance)";
} else if (jobData.hireChance >= 0.4) {
chanceText = currentLanguage === 'spanish' ? " (Probabilidad media)" : " (Medium chance)";
} else {
chanceText = currentLanguage === 'spanish' ? " (Baja probabilidad)" : " (Low chance)";
}
addChoice(getJobName(jobData) + " ($" + jobData.salary + "/month)" + chanceText, function () {
applyForJob(jobData);
});
})(job);
}
addChoice(getText('goBack'), function () {
showMainMenu();
});
}
function applyForJob(job) {
var chance = Math.random();
var actualHireChance = job.hireChance;
// Character appearance affects hiring probability
var characterModifier = 1.0;
var characterBonus = "";
switch (currentCharacterSprite) {
case 'businessCharacterSprite':
// Business appearance gives advantage for office jobs and high-paying positions
if (job.salary >= 3000) {
characterModifier = 1.3; // 30% better chance for higher-paying jobs
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional impresiona al empleador." : " Your professional appearance impresses the employer.";
} else {
characterModifier = 1.1; // 10% better chance for all jobs
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional ayuda." : " Your professional appearance helps.";
}
break;
case 'casualCharacterSprite':
// Casual appearance is neutral but good for customer service and retail
if (job.nameEn.includes("Customer") || job.nameEn.includes("Retail") || job.nameEn.includes("Sales")) {
characterModifier = 1.2; // 20% better for customer-facing roles
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia relajada es perfecta para este trabajo." : " Your approachable appearance is perfect for this role.";
} else {
characterModifier = 1.0; // No change
}
break;
case 'artisticCharacterSprite':
// Artistic appearance is great for creative roles but poor for traditional business
if (job.nameEn.includes("Marketing") || job.salary <= 2000) {
characterModifier = 1.25; // 25% better for creative/entry-level roles
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia creativa destaca positivamente." : " Your creative appearance stands out positively.";
} else if (job.salary >= 4000) {
characterModifier = 0.7; // 30% worse for high-paying traditional roles
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia poco convencional preocupa al empleador." : " Your unconventional appearance concerns the employer.";
} else {
characterModifier = 0.9; // 10% worse for mid-level traditional roles
}
break;
case 'sportCharacterSprite':
// Athletic appearance is great for physical jobs and security
if (job.nameEn.includes("Warehouse") || job.nameEn.includes("Security") || job.nameEn.includes("Delivery") || job.nameEn.includes("Driver")) {
characterModifier = 1.4; // 40% better for physical jobs
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia atlética es perfecta para este trabajo físico." : " Your athletic appearance is perfect for this physical job.";
} else if (job.salary >= 5000) {
characterModifier = 0.8; // 20% worse for high-level office jobs
characterBonus = currentLanguage === 'spanish' ? " El empleador prefiere una apariencia más formal." : " The employer prefers a more formal appearance.";
} else {
characterModifier = 1.0; // No change for other jobs
}
break;
case 'maleExecutiveSprite':
// Executive male appearance is excellent for high-level positions
if (job.salary >= 4000) {
characterModifier = 1.5; // 50% better chance for high-paying executive jobs
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia ejecutiva impresiona mucho al empleador." : " Your executive appearance greatly impresses the employer.";
} else if (job.salary >= 2000) {
characterModifier = 1.2; // 20% better for mid-level jobs
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional es muy respetada." : " Your professional appearance is highly respected.";
} else {
characterModifier = 1.1; // Still good for entry-level
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia profesional ayuda." : " Your professional appearance helps.";
}
break;
case 'maleCasualSprite':
// Casual male appearance is good for customer service and relaxed environments
if (job.nameEn.includes("Customer") || job.nameEn.includes("Retail") || job.nameEn.includes("Sales")) {
characterModifier = 1.3; // 30% better for customer-facing roles
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia relajada y amigable es perfecta para este trabajo." : " Your relaxed and friendly appearance is perfect for this role.";
} else if (job.salary >= 5000) {
characterModifier = 0.9; // 10% worse for very high-level jobs
characterBonus = currentLanguage === 'spanish' ? " El empleador prefiere una apariencia más formal." : " The employer prefers a more formal appearance.";
} else {
characterModifier = 1.0; // Neutral for other jobs
}
break;
case 'maleWorkerSprite':
// Worker male appearance is excellent for blue-collar and physical jobs
if (job.nameEn.includes("Warehouse") || job.nameEn.includes("Security") || job.nameEn.includes("Delivery") || job.nameEn.includes("Driver") || job.salary <= 2500) {
characterModifier = 1.4; // 40% better for blue-collar jobs
characterBonus = currentLanguage === 'spanish' ? " Tu apariencia de trabajador es exactamente lo que buscan." : " Your working man appearance is exactly what they're looking for.";
} else if (job.salary >= 4000) {
characterModifier = 0.7; // 30% worse for white-collar jobs
characterBonus = currentLanguage === 'spanish' ? " El empleador busca una apariencia más corporativa." : " The employer is looking for a more corporate appearance.";
} else {
characterModifier = 1.0; // Neutral for mid-level jobs
}
break;
case 'maleAthleticSprite':
// Athletic male appearance is great for sports, security, and physical jobs
if (job.nameEn.includes("Warehouse") || job.nameEn.includes("Security") || job.nameEn.includes("Delivery") || job.nameEn.includes("Driver")) {
characterModifier = 1.45; // 45% better for physical jobs
characterBonus = currentLanguage === 'spanish' ? " Tu físico atlético es perfecto para este trabajo demandante." : " Your athletic physique is perfect for this demanding job.";
} else if (job.nameEn.includes("Customer") || job.nameEn.includes("Sales")) {
characterModifier = 1.15; // 15% better for customer roles (confidence boost)
characterBonus = currentLanguage === 'spanish' ? " Tu confianza atlética impresiona a los clientes." : " Your athletic confidence impresses customers.";
} else if (job.salary >= 5000) {
characterModifier = 0.85; // 15% worse for high-level office jobs
characterBonus = currentLanguage === 'spanish' ? " El empleador prefiere una apariencia más corporativa." : " The employer prefers a more corporate appearance.";
} else {
characterModifier = 1.0; // Neutral for other jobs
}
break;
case 'basicCharacterSprite':
default:
// Basic appearance is neutral - no modifiers
characterModifier = 1.0;
break;
}
// Apply character modifier to hire chance
actualHireChance = Math.min(0.95, actualHireChance * characterModifier); // Cap at 95%
// If player was homeless and doesn't have at least $1,000,000, make jobs nearly impossible
if (isHomeless && playerMoney < 1000000) {
actualHireChance = 0.05; // Only 5% chance for any job when homeless without million dollars
eventText.setText(currentLanguage === 'spanish' ? "El empleador nota tu historial de vagabundismo y parece reacio a contratarte. Necesitas demostrar estabilidad financiera primero." : "The employer notices your homeless background and seems reluctant to hire you. You need to prove financial stability first.");
}
// Use modified hiring probability
if (chance < actualHireChance) {
playerJob = getJobName(job);
playerSalary = job.salary;
playerHappiness += job.happiness;
monthsUnemployed = 0;
// If homeless player gets a job with million+ dollars, they can escape homelessness
if (isHomeless && playerMoney >= 1000000) {
isHomeless = false;
storage.isHomeless = false;
eventText.setText(getText('congratsJob') + getJobName(job) + "! " + (currentLanguage === 'spanish' ? "¡Tu estabilidad financiera te ha ayudado a escapar de la vida sin hogar!" : "Your financial stability has helped you escape homelessness!") + characterBonus);
} else {
eventText.setText(getText('congratsJob') + getJobName(job) + "!" + characterBonus);
}
playSound('success');
} else {
if (isHomeless && playerMoney < 1000000) {
eventText.setText(currentLanguage === 'spanish' ? "No conseguiste el trabajo. Los empleadores dudan de contratar a alguien sin hogar sin estabilidad financiera demostrada." : "You didn't get the job. Employers hesitate to hire someone homeless without proven financial stability.");
} else {
var rejectionMessage = getText('noJob');
// Add character-specific rejection feedback for negative modifiers
if (characterModifier < 1.0 && characterBonus !== "") {
rejectionMessage += characterBonus;
}
eventText.setText(rejectionMessage);
}
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
}
function showGambling() {
currentScene = "gambling";
eventText.setText(getText('gamblingMenu'));
clearChoices();
// Lottery ticket option
addChoice(getText('lottery'), function () {
if (playerMoney < 50) {
eventText.setText(getText('notEnoughMoneyGamble'));
clearChoices();
addChoice(getText('goBack'), function () {
showMainMenu();
});
return;
}
playerMoney -= 50;
var chance = Math.random();
if (chance < 0.3) {
// 30% chance to win
var winAmount = Math.floor(Math.random() * 300) + 100; // Win $100-$400
playerMoney += winAmount;
playerHappiness += 15;
eventText.setText(getText('gamblingWin') + winAmount + "!");
playSound('success');
} else {
playerHappiness -= 5;
eventText.setText(getText('gamblingLose'));
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
// Casino option
addChoice(getText('casino'), function () {
if (playerMoney < 100) {
eventText.setText(getText('notEnoughMoneyGamble'));
clearChoices();
addChoice(getText('goBack'), function () {
showMainMenu();
});
return;
}
playerMoney -= 100;
var chance = Math.random();
if (chance < 0.25) {
// 25% chance to win
var winAmount = Math.floor(Math.random() * 500) + 200; // Win $200-$700
playerMoney += winAmount;
playerHappiness += 20;
eventText.setText(getText('gamblingWin') + winAmount + "!");
playSound('success');
} else {
playerHappiness -= 10;
eventText.setText(getText('gamblingLose'));
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
// Sports betting option
addChoice(getText('sportsBet'), function () {
if (playerMoney < 75) {
eventText.setText(getText('notEnoughMoneyGamble'));
clearChoices();
addChoice(getText('goBack'), function () {
showMainMenu();
});
return;
}
playerMoney -= 75;
var chance = Math.random();
if (chance < 0.35) {
// 35% chance to win
var winAmount = Math.floor(Math.random() * 250) + 150; // Win $150-$400
playerMoney += winAmount;
playerHappiness += 12;
eventText.setText(getText('gamblingWin') + winAmount + "!");
playSound('success');
} else {
playerHappiness -= 8;
eventText.setText(getText('gamblingLose'));
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
addChoice(getText('goBack'), function () {
showMainMenu();
});
}
function showDating() {
currentScene = "dating";
var person = relationships[Math.floor(Math.random() * relationships.length)];
eventText.setText(currentLanguage === 'spanish' ? "Conoces a " + getPersonName(person) + " en un café local. ¡Parece interesante!" : "You meet " + getPersonName(person) + " at a local cafe. They seem interesting!");
clearChoices();
addChoice(getText('askOut'), function () {
if (playerMoney < 100) {
eventText.setText(getText('notEnoughMoney'));
clearChoices();
addChoice(getText('goBack'), function () {
showMainMenu();
});
return;
}
playerMoney -= 100;
var success = Math.random() > 0.4;
if (success) {
playerHappiness += person.happiness;
var relationshipTerm = playerGender === 'male' ? getText('girlfriend') : getText('boyfriend');
// Get gender-specific person name based on player gender and person type
var personName = getPersonName(person);
// For gym partner, adjust the name based on player gender
if (person.nameEn === "Gym Partner") {
if (playerGender === 'male') {
personName = currentLanguage === 'spanish' ? "Compañera de Gimnasio" : "Gym Partner";
} else {
personName = currentLanguage === 'spanish' ? "Compañero de Gimnasio" : "Gym Partner";
}
}
playerRelationship = relationshipTerm + ": " + personName;
eventText.setText(getText('wonderfulTime'));
playSound('success');
} else {
playerHappiness -= 5;
eventText.setText(getText('dateNotWell'));
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
addChoice(getText('justFriends'), function () {
playerHappiness += 3;
eventText.setText(getText('friendlyChat'));
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
addChoice(getText('goBack'), function () {
showMainMenu();
});
}
function advanceDay() {
dayCounter++;
// Age advancement (every 365 days = 1 year)
if (dayCounter % 365 === 0) {
playerAge++;
storage.playerAge = playerAge;
eventText.setText(getText('ageAdvanced') + " " + playerAge + " " + getText('yearsOld') + "!");
clearChoices();
addChoice(getText('continue'), function () {
checkAgeAndHealthGameOver();
});
return;
}
// Daily health effects based on nutrition
if (playerNutrition < 30) {
playerHealth = Math.max(0, playerHealth - 0.5);
} else if (playerNutrition > 70) {
playerHealth = Math.min(100, playerHealth + 0.2);
}
// Age-related health decline
if (playerAge > 60) {
var healthDecline = (playerAge - 60) * 0.1;
playerHealth = Math.max(0, playerHealth - healthDecline);
}
// Nutrition naturally decreases over time
playerNutrition = Math.max(0, playerNutrition - 1);
// Save health and nutrition to storage
storage.playerHealth = playerHealth;
storage.playerNutrition = playerNutrition;
// Monthly salary
if (dayCounter % 30 === 0 && playerJob !== getText('unemployed')) {
var netSalary = playerSalary - monthlyChildExpenses;
playerMoney += netSalary;
var salaryText = getText('payday') + playerSalary;
if (monthlyChildExpenses > 0) {
salaryText += currentLanguage === 'spanish' ? " (Gastos de hijos: -$" + monthlyChildExpenses + ")" : " (Child expenses: -$" + monthlyChildExpenses + ")";
}
salaryText += currentLanguage === 'spanish' ? " de tu trabajo como " + playerJob : " from your job as " + playerJob;
eventText.setText(salaryText);
clearChoices();
addChoice(getText('continue'), function () {
checkDailyEvents();
});
return;
}
// Track unemployment
if (playerJob === "Unemployed") {
monthsUnemployed++;
}
// Random events (10% chance for regular events, 0.5% chance for special events)
var eventChance = Math.random();
if (eventChance < 0.005) {
showSpecialEvent();
} else if (eventChance < 0.105) {
showRandomEvent();
} else {
checkDailyEvents();
}
}
function showSpecialEvent() {
var specialEvents = [{
type: "headhunter",
chance: 0.3
}, {
type: "inheritance",
chance: 0.2
}, {
type: "scholarship",
chance: 0.2
}, {
type: "business",
chance: 0.15
}, {
type: "celebrity",
chance: 0.1
}, {
type: "contest",
chance: 0.05
}];
var eventType = specialEvents[Math.floor(Math.random() * specialEvents.length)].type;
switch (eventType) {
case "headhunter":
eventText.setText(getText('headhunterOffer'));
clearChoices();
addChoice(getText('acceptOffer'), function () {
playerJob = "Executive";
playerSalary = 5500;
playerHappiness += 25;
playerMoney += 1000; // Signing bonus
monthsUnemployed = 0;
eventText.setText(getText('jobOfferAccepted'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
addChoice(getText('declineOffer'), function () {
playerHappiness += 5; // Feel good about being selective
eventText.setText(getText('jobOfferDeclined'));
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
break;
case "inheritance":
playerMoney += 3000;
playerHappiness += 20;
eventText.setText(getText('inheritanceMoney'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
break;
case "scholarship":
playerMoney += 2500;
playerHappiness += 15;
eventText.setText(getText('scholarshipOffer'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
break;
case "business":
if (playerMoney >= 1000) {
eventText.setText(getText('businessOpportunity'));
clearChoices();
addChoice(getText('investInBusiness'), function () {
playerMoney -= 1000;
var success = Math.random() > 0.4; // 60% chance of success
if (success) {
playerMoney += 2500;
playerHappiness += 30;
eventText.setText(getText('businessSuccess'));
playSound('success');
} else {
playerHappiness -= 15;
eventText.setText(getText('businessFailure'));
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
addChoice(getText('skipInvestment'), function () {
eventText.setText(getText('jobOfferDeclined'));
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
});
} else {
// Fallback to celebrity event if not enough money
playerMoney += 800;
playerHappiness += 12;
eventText.setText(getText('celebrityEncounter'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
}
break;
case "celebrity":
playerMoney += 800;
playerHappiness += 12;
eventText.setText(getText('celebrityEncounter'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
break;
case "contest":
playerMoney += 1200;
playerHappiness += 18;
eventText.setText(getText('contestWin'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50; // Daily expenses
advanceDay();
});
break;
}
}
function showRandomEvent() {
var events = [{
textEn: "You found $50 on the street!",
textEs: "¡Encontraste $50 en la calle!",
money: 50,
happiness: 5
}, {
textEn: "Your car broke down. Repair costs $300.",
textEs: "Tu auto se descompuso. Los costos de reparación son $300.",
money: -300,
happiness: -10
}, {
textEn: "You won a small lottery prize of $200!",
textEs: "¡Ganaste un pequeño premio de lotería de $200!",
money: 200,
happiness: 15
}, {
textEn: "You got sick and had to pay $150 for medicine.",
textEs: "Te enfermaste y tuviste que pagar $150 por medicina.",
money: -150,
happiness: -5
}];
var event = events[Math.floor(Math.random() * events.length)];
playerMoney = Math.max(0, playerMoney + event.money);
playerHappiness = Math.max(0, Math.min(100, playerHappiness + event.happiness));
eventText.setText(currentLanguage === 'spanish' ? event.textEs : event.textEn);
clearChoices();
addChoice(getText('continue'), function () {
checkDailyEvents();
});
}
function showExtrasMenu() {
currentScene = "extras";
eventText.setText(currentLanguage === 'spanish' ? "Opciones adicionales:" : "Additional options:");
clearChoices();
addChoice(currentLanguage === 'spanish' ? "Datos del jugador" : "Player data", function () {
showPlayerDataMenu();
});
addChoice(currentLanguage === 'spanish' ? "Ver estadísticas detalladas" : "View detailed stats", function () {
showDetailedStats();
});
addChoice(currentLanguage === 'spanish' ? "Configurar dificultad" : "Configure difficulty", function () {
showDifficultySettings();
});
addChoice(getText('customizeCharacter'), function () {
showCharacterCustomization();
});
addChoice(currentLanguage === 'spanish' ? "Modo vagabundo" : "Homeless mode", function () {
showHomelessModeMenu();
});
addChoice(currentLanguage === 'spanish' ? "Reiniciar juego" : "Reset game", function () {
resetGame();
});
addChoice(getText('lifeOptions'), function () {
showLifeOptionsMenu();
});
addChoice(getText('goBack'), function () {
showMainMenu();
});
}
function showPlayerDataMenu() {
currentScene = "playerData";
eventText.setText(currentLanguage === 'spanish' ? "Datos del Jugador:" : "Player Data:");
clearChoices();
// Create temporary displays for player data if they don't exist
if (!ageDisplay) {
ageDisplay = game.addChild(new StatDisplay(getText('age'), playerAge, 0x9b59b6));
ageDisplay.x = 224;
ageDisplay.y = 650;
ageDisplay.updateValue(playerAge, "");
}
if (!healthDisplay) {
healthDisplay = game.addChild(new StatDisplay(getText('health'), playerHealth + "%", 0xe74c3c));
healthDisplay.x = 224;
healthDisplay.y = 750;
healthDisplay.updateValue(playerHealth + "%", "");
}
if (!nutritionDisplay) {
nutritionDisplay = game.addChild(new StatDisplay(getText('nutrition'), playerNutrition + "%", 0x2ecc71));
nutritionDisplay.x = 224;
nutritionDisplay.y = 850;
nutritionDisplay.updateValue(playerNutrition + "%", "");
}
// Show displays
ageDisplay.alpha = 1;
healthDisplay.alpha = 1;
nutritionDisplay.alpha = 1;
addChoice(getText('goBack'), function () {
// Hide displays when going back
if (ageDisplay) ageDisplay.alpha = 0;
if (healthDisplay) healthDisplay.alpha = 0;
if (nutritionDisplay) nutritionDisplay.alpha = 0;
showExtrasMenu();
});
}
function showDetailedStats() {
var yearsLived = Math.floor((dayCounter - 1) / 365);
var daysInCurrentYear = (dayCounter - 1) % 365;
var statsText = currentLanguage === 'spanish' ? "Estadísticas detalladas:\n\nDía: " + dayCounter + "\nEdad: " + playerAge + " años\nSalud: " + Math.floor(playerHealth) + "%\nNutrición: " + Math.floor(playerNutrition) + "%\nMeses desempleado: " + monthsUnemployed + "\nAños vividos: " + yearsLived + "\nDías en el año actual: " + daysInCurrentYear : "Detailed statistics:\n\nDay: " + dayCounter + "\nAge: " + playerAge + " years\nHealth: " + Math.floor(playerHealth) + "%\nNutrition: " + Math.floor(playerNutrition) + "%\nMonths unemployed: " + monthsUnemployed + "\nYears lived: " + yearsLived + "\nDays in current year: " + daysInCurrentYear;
eventText.setText(statsText);
clearChoices();
addChoice(getText('goBack'), function () {
showExtrasMenu();
});
}
function showDifficultySettings() {
eventText.setText(currentLanguage === 'spanish' ? "Configurar dificultad del juego:" : "Configure game difficulty:");
clearChoices();
addChoice(currentLanguage === 'spanish' ? "Fácil (más dinero)" : "Easy (more money)", function () {
playerMoney += 500;
eventText.setText(currentLanguage === 'spanish' ? "Dificultad configurada a Fácil. ¡Recibiste $500 extra!" : "Difficulty set to Easy. You received $500 bonus!");
clearChoices();
addChoice(getText('continue'), function () {
showExtrasMenu();
});
});
addChoice(currentLanguage === 'spanish' ? "Difícil (menos dinero)" : "Hard (less money)", function () {
playerMoney = Math.max(0, playerMoney - 200);
playerHappiness += 10;
eventText.setText(currentLanguage === 'spanish' ? "Dificultad configurada a Difícil. Perdiste $200 pero ganaste experiencia (+10 felicidad)." : "Difficulty set to Hard. You lost $200 but gained experience (+10 happiness).");
clearChoices();
addChoice(getText('continue'), function () {
showExtrasMenu();
});
});
addChoice(getText('goBack'), function () {
showExtrasMenu();
});
}
function showLifeOptionsMenu() {
currentScene = "lifeOptions";
eventText.setText(getText('lifeOptions') + ":");
clearChoices();
// Health & Nutrition Section
addChoice(currentLanguage === 'spanish' ? "🍎 Salud y Nutrición" : "🍎 Health & Nutrition", function () {
showHealthNutritionMenu();
});
// Family & Home Section
addChoice(currentLanguage === 'spanish' ? "🏠 Familia y Hogar" : "🏠 Family & Home", function () {
showFamilyHomeMenu();
});
// Personal Items Section
addChoice(currentLanguage === 'spanish' ? "💎 Pertenencias Personales" : "💎 Personal Belongings", function () {
showPersonalItemsMenu();
});
addChoice(getText('goBack'), function () {
showExtrasMenu();
});
}
function showHealthNutritionMenu() {
currentScene = "healthNutrition";
eventText.setText(currentLanguage === 'spanish' ? "Opciones de Salud y Nutrición:" : "Health & Nutrition Options:");
clearChoices();
addChoice(getText('eatHealthy'), function () {
playerNutrition = Math.min(100, playerNutrition + 20);
playerHealth = Math.min(100, playerHealth + 5);
playerMoney -= 80; // Healthy food costs more
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
});
addChoice(getText('eatJunk'), function () {
playerNutrition = Math.min(100, playerNutrition + 5);
playerHealth = Math.max(0, playerHealth - 2);
playerMoney -= 30; // Junk food is cheaper
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
});
addChoice(getText('exercise'), function () {
playerHealth = Math.min(100, playerHealth + 10);
playerHappiness = Math.min(100, playerHappiness + 5);
playerMoney -= 40; // Gym membership or equipment costs
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
});
addChoice(getText('rest'), function () {
playerHealth = Math.min(100, playerHealth + 15);
playerMoney -= 200; // Medical checkup cost
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
});
addChoice(getText('goBack'), function () {
showLifeOptionsMenu();
});
}
function showFamilyHomeMenu() {
currentScene = "familyHome";
eventText.setText(currentLanguage === 'spanish' ? "Opciones de Familia y Hogar:" : "Family & Home Options:");
clearChoices();
addChoice(getText('findHouse'), function () {
showFindHouse();
});
addChoice(getText('haveChildren'), function () {
showHaveChildren();
});
addChoice(getText('visitParents'), function () {
showVisitParents();
});
addChoice(getText('goBack'), function () {
showLifeOptionsMenu();
});
}
function showPersonalItemsMenu() {
currentScene = "personalItems";
eventText.setText(currentLanguage === 'spanish' ? "Opciones de Pertenencias Personales:" : "Personal Belongings Options:");
clearChoices();
addChoice(getText('viewBelongings'), function () {
showBelongingsMenu();
});
addChoice(getText('sellItems'), function () {
showSellItems();
});
addChoice(getText('goBack'), function () {
showLifeOptionsMenu();
});
}
function showSellItems() {
var itemsValue = Math.floor(Math.random() * 800) + 200;
playerMoney += itemsValue;
playerHappiness -= 5;
eventText.setText(getText('soldBelongings') + itemsValue + "!");
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
}
function showFindHouse() {
var housePrice = parseInt(getText('housePrice'));
if (playerMoney >= housePrice) {
playerMoney -= housePrice;
playerHouse = true;
storage.playerHouse = true;
playerHappiness += 25;
eventText.setText(getText('boughtHouse') + housePrice + "!");
playSound('success');
} else {
eventText.setText(getText('notEnoughForHouse'));
playSound('failure');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
}
function showHaveChildren() {
if (playerRelationship === getText('single')) {
eventText.setText(getText('needPartnerForChild'));
playSound('failure');
} else {
playerChildren++;
storage.playerChildren = playerChildren;
monthlyChildExpenses += parseInt(getText('childExpenses'));
storage.monthlyChildExpenses = monthlyChildExpenses;
playerHappiness += 20;
eventText.setText(getText('hadChild'));
playSound('success');
}
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
}
function showVisitParents() {
playerHappiness += 15;
eventText.setText(getText('visitedParents'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
}
function showBelongingsMenu() {
currentScene = "belongings";
var belongingsText = getText('belongingsTitle') + ":\n\n";
// Show owned items
var ownedCount = 0;
for (var i = 0; i < shopItems.length; i++) {
var item = shopItems[i];
if (playerBelongings[item.id]) {
belongingsText += "✓ " + getText(item.nameKey) + "\n";
ownedCount++;
}
}
if (ownedCount === 0) {
belongingsText += currentLanguage === 'spanish' ? "No tienes pertenencias aún." : "You don't own any items yet.";
}
eventText.setText(belongingsText);
clearChoices();
// Show available items to buy
for (var i = 0; i < shopItems.length; i++) {
var item = shopItems[i];
(function (itemData) {
var buttonText = getText(itemData.nameKey) + " - $" + itemData.price;
var canBuy = !playerBelongings[itemData.id] && playerMoney >= itemData.price;
if (playerBelongings[itemData.id]) {
buttonText += " (" + getText('alreadyOwn') + ")";
} else if (playerMoney < itemData.price) {
buttonText += " (" + getText('cannotAfford') + ")";
}
addChoice(buttonText, function () {
if (playerBelongings[itemData.id]) {
eventText.setText(currentLanguage === 'spanish' ? "Ya tienes este artículo." : "You already own this item.");
clearChoices();
addChoice(getText('goBack'), function () {
showBelongingsMenu();
});
} else if (playerMoney < itemData.price) {
eventText.setText(currentLanguage === 'spanish' ? "No tienes suficiente dinero para comprar esto." : "You don't have enough money to buy this.");
clearChoices();
addChoice(getText('goBack'), function () {
showBelongingsMenu();
});
} else {
playerMoney -= itemData.price;
playerHappiness = Math.min(100, playerHappiness + itemData.happiness);
playerBelongings[itemData.id] = true;
storage.playerBelongings = playerBelongings;
eventText.setText(getText('purchaseSuccess') + getText(itemData.nameKey) + "! +" + itemData.happiness + " " + getText('happiness'));
playSound('success');
clearChoices();
addChoice(getText('continue'), function () {
playerMoney -= 50;
advanceDay();
});
}
});
})(item);
}
addChoice(getText('goBack'), function () {
showLifeOptionsMenu();
});
}
function resetGame() {
eventText.setText(currentLanguage === 'spanish' ? "¿Estás seguro de que quieres reiniciar el juego?" : "Are you sure you want to reset the game?");
clearChoices();
addChoice(currentLanguage === 'spanish' ? "Sí, reiniciar" : "Yes, reset", function () {
// Reset all game variables
playerMoney = 1000;
playerJob = "Unemployed";
playerSalary = 0;
playerHappiness = 50;
playerRelationship = getText('single');
playerAge = 22;
playerHealth = 100;
playerNutrition = 50;
monthsUnemployed = 0;
dayCounter = 1;
currentScene = "main";
playerHouse = false;
playerChildren = 0;
monthlyChildExpenses = 0;
playerBelongings = {};
isHomeless = false;
storage.language = currentLanguage;
storage.gender = playerGender;
storage.playerAge = 22;
storage.playerHealth = 100;
storage.playerNutrition = 50;
storage.playerHouse = false;
storage.playerChildren = 0;
storage.monthlyChildExpenses = 0;
storage.playerBelongings = {};
storage.isHomeless = false;
currentCharacterSprite = 'basicCharacterSprite';
storage.characterSprite = 'basicCharacterSprite';
// Update character display
if (characterDisplay) {
characterDisplay.destroy();
}
characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, {
anchorX: 0.5,
anchorY: 0.5,
x: 1650,
y: 400
}));
characterDisplay.scaleX = 0.8;
characterDisplay.scaleY = 0.8;
updateUILanguage();
showMainMenu();
});
addChoice(currentLanguage === 'spanish' ? "No, cancelar" : "No, cancel", function () {
showExtrasMenu();
});
}
function checkAgeAndHealthGameOver() {
updateStats();
if (checkGameOver()) {
return;
}
checkDailyEvents();
}
function showCharacterCustomization() {
currentScene = "characterCustomization";
eventText.setText(getText('selectCharacterSprite'));
clearChoices();
var characterOptions = [];
// Add appropriate character options based on gender
if (playerGender === 'male') {
characterOptions = [{
id: 'businessCharacterSprite',
nameKey: 'businessCharacter',
color: 0x2c3e50
}, {
id: 'maleExecutiveSprite',
nameKey: 'maleExecutive',
color: 0x34495e
}, {
id: 'maleCasualSprite',
nameKey: 'maleCasual',
color: 0x3498db
}, {
id: 'maleWorkerSprite',
nameKey: 'maleWorker',
color: 0x95a5a6
}, {
id: 'maleAthleticSprite',
nameKey: 'maleAthletic',
color: 0xe67e22
}, {
id: 'basicCharacterSprite',
nameKey: 'basicCharacter',
color: 0x8e44ad
}];
} else if (playerGender === 'female') {
characterOptions = [{
id: 'artisticCharacterSprite',
nameKey: 'artisticCharacter',
color: 0xe74c3c
}, {
id: 'casualCharacterSprite',
nameKey: 'casualCharacter',
color: 0x27ae60
}, {
id: 'sportCharacterSprite',
nameKey: 'sportCharacter',
color: 0xf39c12
}, {
id: 'basicCharacterSprite',
nameKey: 'basicCharacter',
color: 0x8e44ad
}];
} else {
// Default options for undefined gender
characterOptions = [{
id: 'basicCharacterSprite',
nameKey: 'basicCharacter',
color: 0x8e44ad
}, {
id: 'businessCharacterSprite',
nameKey: 'businessCharacter',
color: 0x2c3e50
}, {
id: 'casualCharacterSprite',
nameKey: 'casualCharacter',
color: 0x27ae60
}, {
id: 'artisticCharacterSprite',
nameKey: 'artisticCharacter',
color: 0xe74c3c
}, {
id: 'sportCharacterSprite',
nameKey: 'sportCharacter',
color: 0xf39c12
}];
}
for (var i = 0; i < characterOptions.length; i++) {
var character = characterOptions[i];
(function (charData) {
var isSelected = currentCharacterSprite === charData.id;
var buttonText = getText(charData.nameKey) + (isSelected ? " ✓" : "");
addChoice(buttonText, function () {
currentCharacterSprite = charData.id;
storage.characterSprite = charData.id;
// Update character display
if (characterDisplay) {
characterDisplay.destroy();
}
characterDisplay = game.addChild(LK.getAsset(currentCharacterSprite, {
anchorX: 0.5,
anchorY: 0.5,
x: 1650,
y: 400
}));
characterDisplay.scaleX = 0.8;
characterDisplay.scaleY = 0.8;
eventText.setText(getText('characterChanged'));
playSound('buttonClick');
clearChoices();
addChoice(getText('continue'), function () {
showCharacterCustomization();
});
});
})(character);
}
addChoice(getText('goBack'), function () {
showExtrasMenu();
});
}
function showHomelessModeMenu() {
currentScene = "homeless";
eventText.setText(currentLanguage === 'spanish' ? "Modo Vagabundo - Juega como una persona sin hogar:" : "Homeless Mode - Play as a homeless person:");
clearChoices();
addChoice(currentLanguage === 'spanish' ? "Comenzar como vagabundo" : "Start as homeless", function () {
// Reset player to homeless state
playerMoney = 0;
playerJob = "Unemployed";
playerSalary = 0;
playerHappiness = 20;
playerRelationship = getText('single');
playerHouse = false;
playerHealth = Math.max(30, playerHealth - 30);
playerNutrition = Math.max(10, playerNutrition - 40);
// Mark player as homeless in storage - this will make returning to normal life extremely difficult
storage.isHomeless = true;
storage.playerHouse = false;
storage.playerHealth = playerHealth;
storage.playerNutrition = playerNutrition;
eventText.setText(currentLanguage === 'spanish' ? "Ahora eres una persona sin hogar. Debes sobrevivir en las calles. Tu salud y nutrición han disminuido. ADVERTENCIA: Será extremadamente difícil volver a la vida normal." : "You are now homeless. You must survive on the streets. Your health and nutrition have decreased. WARNING: It will be extremely difficult to return to normal life.");
clearChoices();
addChoice(getText('continue'), function () {
updateStats();
showHomelessMenu();
});
});
addChoice(currentLanguage === 'spanish' ? "Opciones de supervivencia" : "Survival options", function () {
showHomelessMenu();
});
addChoice(getText('goBack'), function () {
showExtrasMenu();
});
}
function showHomelessMenu() {
currentScene = "homelessSurvival";
eventText.setText(currentLanguage === 'spanish' ? "Opciones de supervivencia en las calles:" : "Street survival options:");
clearChoices();
addChoice(currentLanguage === 'spanish' ? "Buscar comida en basureros" : "Search for food in dumpsters", function () {
var foodFound = Math.random() > 0.5;
if (foodFound) {
playerNutrition = Math.min(100, playerNutrition + 15);
playerHealth = Math.max(0, playerHealth - 5); // Risk of getting sick
playerHappiness = Math.max(0, playerHappiness - 5);
eventText.setText(currentLanguage === 'spanish' ? "Encontraste algo de comida, pero no estaba muy fresca. +15 nutrición, -5 salud, -5 felicidad." : "You found some food, but it wasn't very fresh. +15 nutrition, -5 health, -5 happiness.");
} else {
playerHappiness = Math.max(0, playerHappiness - 10);
eventText.setText(currentLanguage === 'spanish' ? "No encontraste nada útil. Tu moral está baja. -10 felicidad." : "You didn't find anything useful. Your morale is low. -10 happiness.");
}
clearChoices();
addChoice(getText('continue'), function () {
advanceDay();
});
});
addChoice(currentLanguage === 'spanish' ? "Pedir dinero en la calle" : "Ask for money on the street", function () {
var moneyReceived = Math.floor(Math.random() * 20) + 5;
playerMoney += moneyReceived;
playerHappiness = Math.max(0, playerHappiness - 3);
eventText.setText(currentLanguage === 'spanish' ? "Algunas personas te dieron algo de dinero. Recibiste $" + moneyReceived + ". -3 felicidad por la humillación." : "Some people gave you some money. You received $" + moneyReceived + ". -3 happiness from humiliation.");
clearChoices();
addChoice(getText('continue'), function () {
advanceDay();
});
});
addChoice(currentLanguage === 'spanish' ? "Dormir en refugio" : "Sleep in shelter", function () {
if (playerMoney >= 10) {
playerMoney -= 10;
playerHealth = Math.min(100, playerHealth + 10);
playerHappiness = Math.min(100, playerHappiness + 5);
eventText.setText(currentLanguage === 'spanish' ? "Pasaste la noche en un refugio. Te sientes mejor. -$10, +10 salud, +5 felicidad." : "You spent the night in a shelter. You feel better. -$10, +10 health, +5 happiness.");
} else {
playerHealth = Math.max(0, playerHealth - 15);
playerHappiness = Math.max(0, playerHappiness - 10);
eventText.setText(currentLanguage === 'spanish' ? "No tienes dinero para el refugio. Dormiste en la calle. -15 salud, -10 felicidad." : "You don't have money for shelter. You slept on the street. -15 health, -10 happiness.");
}
clearChoices();
addChoice(getText('continue'), function () {
advanceDay();
});
});
addChoice(currentLanguage === 'spanish' ? "Buscar trabajo temporal" : "Look for temporary work", function () {
var jobFound = Math.random() > 0.7; // 30% chance
if (jobFound) {
var payment = Math.floor(Math.random() * 50) + 30;
playerMoney += payment;
playerHappiness = Math.min(100, playerHappiness + 15);
playerHealth = Math.max(0, playerHealth - 5);
eventText.setText(currentLanguage === 'spanish' ? "Encontraste trabajo temporal por un día. Ganaste $" + payment + ". +15 felicidad, -5 salud por el trabajo duro." : "You found temporary work for a day. You earned $" + payment + ". +15 happiness, -5 health from hard work.");
} else {
playerHappiness = Math.max(0, playerHappiness - 8);
eventText.setText(currentLanguage === 'spanish' ? "No encontraste trabajo. La gente te rechazó. -8 felicidad." : "You didn't find work. People rejected you. -8 happiness.");
}
clearChoices();
addChoice(getText('continue'), function () {
advanceDay();
});
});
addChoice(currentLanguage === 'spanish' ? "Intentar conseguir ayuda social" : "Try to get social help", function () {
var helpReceived = Math.random() > 0.6; // 40% chance
if (helpReceived) {
playerMoney += 100;
playerHappiness = Math.min(100, playerHappiness + 20);
playerNutrition = Math.min(100, playerNutrition + 25);
eventText.setText(currentLanguage === 'spanish' ? "Recibiste ayuda de una organización benéfica. +$100, +20 felicidad, +25 nutrición." : "You received help from a charity organization. +$100, +20 happiness, +25 nutrition.");
} else {
playerHappiness = Math.max(0, playerHappiness - 5);
eventText.setText(currentLanguage === 'spanish' ? "No pudiste obtener ayuda hoy. Los recursos están limitados. -5 felicidad." : "You couldn't get help today. Resources are limited. -5 happiness.");
}
clearChoices();
addChoice(getText('continue'), function () {
advanceDay();
});
});
addChoice(getText('goBack'), function () {
showExtrasMenu();
});
}
function checkDailyEvents() {
updateStats();
if (checkGameOver()) {
return;
}
showMainMenu();
}
// Initialize the game
if (showingLanguageMenu) {
showLanguageMenu();
} else if (showingGenderMenu || playerGender === null) {
showingGenderMenu = true;
showGenderMenu();
} else {
updateUILanguage();
showMainMenu();
}
Personaje artística viendo a la cámara pixel art. In-Game asset. 2d. High contrast. No shadows
Hombre atlético mirando a la cámara pixel art. In-Game asset. 2d. High contrast. No shadows
Hombre trabajador mirando a la cámara pixel art. In-Game asset. 2d. High contrast. No shadows
Hombre ejecutivo mirando a la cámara pixel art. In-Game asset. 2d. High contrast. No shadows
Personaje hombre casual mirando a la cámara pixel art. In-Game asset. 2d. High contrast. No shadows