User prompt
Añade sprites de personaje para hombres osea para el género hombre
User prompt
Has que dependiendo de si eres mujer o hombre tengas un sprite de personaje o otro ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Has que dependiendo de tu personaje tengas más o menos probabilidad de ser contratado en trabajos ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Ahora has la opción de personalizar el personaje canviando de sprite
User prompt
Has que dependiendo si eres hombre o mujer tu interés amoroso tenga una a en el final osea sea compañera de gimnasio y si eres mujer compañero de gimnasio
User prompt
Has que el jugador pueda morir por tener muy baja felicidad y muy mala salud ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Es que sea difícil volver a la normalidad después de seleccionar la opción de vagabundo que sea después de tener un millón de pesos o dólares ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Has opciones de ser vagabundo en el menú de extras para jugar como vagabundo ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Separa las opciones Delos datos del jugador ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Rre as el menú para que sea más bonito
User prompt
Añade la opción de comprar carros ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Ayuda no funciona hacer sonidos ni tu :(
User prompt
Ordena las opciones por ejemplo comer en una sección dentro de extra hacer ejercicio también pertenencia también y asi ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Has que las opciones de comer y hacer ejercicios estén en extras, opciones de vida ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Añade un sistema de años donde la edad máxima sean 150 años y la mínima sea de 1 y dependa de cuánto te alimentes que comas y la salud del personaje ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Añade la opción de ver pertenencias seleccionar que casa vas a comprar comprar carros, anillos, PlayStations, y más ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Añade más trabajos y probabilidades dependiendo de cuánto te paguen de que te contraten ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Has una opción de vender lo que tienes buscar casa y tener hijos y padres ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Has que los eventos especiales tengan muy baja probabilidad de aparecer ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Añade un botón cuando empiezas el juego para extras osea mas opciones ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Añade eventos especiales que tengan probabilidad de aparecer por ejemplo que alguien te quiera contratar y darte 5500 por mes y cosas así ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Añade opción de apostar donde tengas probabilidad de ganar y perder dinero ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Has que después del menú de idiomas te pregunten que genero eres, hombre , mujer. Si eres hombre tengas novia y si eres mujer un novio ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'setText')' in or related to this line: 'moneyDisplay.labelText.setText(getText('money') + ": $" + playerMoney);' Line Number: 317
User prompt
Please fix the bug: 'storage.get is not a function' in or related to this line: 'var currentLanguage = storage.get('language') || 'english';' Line Number: 88 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
/**** * 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); var buttonBg = self.attachAsset('choiceButton', { anchorX: 0.5, anchorY: 0.5 }); var buttonText = new Text2(text, { size: 45, fill: 0xFFFFFF }); buttonText.anchor.set(0.5, 0.5); self.addChild(buttonText); self.action = action; self.down = function (x, y, obj) { LK.getSound('buttonClick').play(); tween(buttonBg, { scaleX: 0.95, scaleY: 0.95 }, { duration: 100 }); if (self.action) { self.action(); } }; self.up = function (x, y, obj) { tween(buttonBg, { scaleX: 1, scaleY: 1 }, { duration: 100 }); }; return self; }); var StatDisplay = Container.expand(function (label, value, color) { var self = Container.call(this); var statBg = self.attachAsset('statBar', { anchorX: 0, anchorY: 0 }); statBg.tint = color || 0x34495e; 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); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x1a252f }); /**** * Game Code ****/ // 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 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 || {}; // Available items to purchase var shopItems = [{ id: "car", nameKey: "carName", price: 15000, happiness: 30, description: "A fast sports car" }, { 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 ", carName: "Sports Car", 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." }, 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 ", carName: "Auto Deportivo", 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." } }; 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 var backgroundPanel = game.addChild(LK.getAsset('backgroundPanel', { anchorX: 0.5, anchorY: 0.5, x: 1024, y: 1366 })); var titleText = new Text2(getText('selectLanguage'), { size: 60, fill: 0xE74C3C }); titleText.anchor.set(0.5, 0); titleText.x = 1024; titleText.y = 150; game.addChild(titleText); // 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'), ""); var ageDisplay = game.addChild(new StatDisplay(getText('age'), playerAge, 0x9b59b6)); ageDisplay.x = 224; ageDisplay.y = 650; ageDisplay.updateValue(playerAge, ""); var healthDisplay = game.addChild(new StatDisplay(getText('health'), playerHealth + "%", 0xe74c3c)); healthDisplay.x = 224; healthDisplay.y = 750; healthDisplay.updateValue(playerHealth + "%", ""); var nutritionDisplay = game.addChild(new StatDisplay(getText('nutrition'), playerNutrition + "%", 0x2ecc71)); nutritionDisplay.x = 224; nutritionDisplay.y = 850; nutritionDisplay.updateValue(playerNutrition + "%", ""); // Event panel var eventPanel = game.addChild(LK.getAsset('eventPanel', { anchorX: 0.5, anchorY: 0, x: 1024, y: 700 })); 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; game.addChild(button); choiceButtons.push(button); } 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'); showingGenderMenu = false; updateUILanguage(); showMainMenu(); }); addChoice(getText('female'), function () { playerGender = 'female'; storage.gender = 'female'; playerRelationship = getText('single'); 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)); ageDisplay.labelText.setText(getText('age') + ": " + playerAge); healthDisplay.labelText.setText(getText('health') + ": " + playerHealth + "%"); 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, ""); ageDisplay.updateValue(playerAge, ""); healthDisplay.updateValue(playerHealth + "%", ""); nutritionDisplay.updateValue(playerNutrition + "%", ""); } function checkGameOver() { // Check age limit if (playerAge >= maxAge) { eventText.setText(getText('diedOfAge') + " " + playerAge + ". " + getText('gameOverAge')); clearChoices(); LK.getSound('failure').play(); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } // Check health if (playerHealth <= 0) { eventText.setText(getText('diedOfHealth') + " " + playerAge + ". " + getText('gameOverHealth')); clearChoices(); LK.getSound('failure').play(); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } if (playerMoney <= 0 && monthsUnemployed >= 3) { eventText.setText(getText('gameOver')); clearChoices(); LK.getSound('failure').play(); LK.setTimeout(function () { LK.showGameOver(); }, 2000); return true; } if (playerMoney >= 10000 && playerHappiness >= 80 && playerRelationship !== getText('single')) { eventText.setText(getText('youWin')); clearChoices(); LK.getSound('success').play(); 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('eatHealthy'), function () { playerNutrition = Math.min(100, playerNutrition + 20); playerHealth = Math.min(100, playerHealth + 5); playerMoney -= 80; // Healthy food costs more advanceDay(); }); addChoice(getText('eatJunk'), function () { playerNutrition = Math.min(100, playerNutrition + 5); playerHealth = Math.max(0, playerHealth - 2); playerMoney -= 30; // Junk food is cheaper advanceDay(); }); addChoice(getText('exercise'), function () { playerHealth = Math.min(100, playerHealth + 10); playerHappiness = Math.min(100, playerHappiness + 5); playerMoney -= 40; // Gym membership or equipment costs advanceDay(); }); addChoice(getText('rest'), function () { playerHealth = Math.min(100, playerHealth + 15); playerMoney -= 200; // Medical checkup cost 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(); // Use job-specific hiring probability if (chance < job.hireChance) { playerJob = getJobName(job); playerSalary = job.salary; playerHappiness += job.happiness; monthsUnemployed = 0; eventText.setText(getText('congratsJob') + getJobName(job) + "!"); LK.getSound('success').play(); } else { eventText.setText(getText('noJob')); LK.getSound('failure').play(); } 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 + "!"); LK.getSound('success').play(); } else { playerHappiness -= 5; eventText.setText(getText('gamblingLose')); LK.getSound('failure').play(); } 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 + "!"); LK.getSound('success').play(); } else { playerHappiness -= 10; eventText.setText(getText('gamblingLose')); LK.getSound('failure').play(); } 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 + "!"); LK.getSound('success').play(); } else { playerHappiness -= 8; eventText.setText(getText('gamblingLose')); LK.getSound('failure').play(); } 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'); playerRelationship = relationshipTerm + ": " + getPersonName(person); eventText.setText(getText('wonderfulTime')); LK.getSound('success').play(); } else { playerHappiness -= 5; eventText.setText(getText('dateNotWell')); LK.getSound('failure').play(); } 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')); LK.getSound('success').play(); 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')); LK.getSound('success').play(); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); break; case "scholarship": playerMoney += 2500; playerHappiness += 15; eventText.setText(getText('scholarshipOffer')); LK.getSound('success').play(); 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')); LK.getSound('success').play(); } else { playerHappiness -= 15; eventText.setText(getText('businessFailure')); LK.getSound('failure').play(); } 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')); LK.getSound('success').play(); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); } break; case "celebrity": playerMoney += 800; playerHappiness += 12; eventText.setText(getText('celebrityEncounter')); LK.getSound('success').play(); clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; // Daily expenses advanceDay(); }); break; case "contest": playerMoney += 1200; playerHappiness += 18; eventText.setText(getText('contestWin')); LK.getSound('success').play(); 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' ? "Ver estadísticas detalladas" : "View detailed stats", function () { showDetailedStats(); }); addChoice(currentLanguage === 'spanish' ? "Configurar dificultad" : "Configure difficulty", function () { showDifficultySettings(); }); addChoice(currentLanguage === 'spanish' ? "Reiniciar juego" : "Reset game", function () { resetGame(); }); addChoice(getText('lifeOptions'), function () { showLifeOptionsMenu(); }); addChoice(getText('goBack'), function () { showMainMenu(); }); } 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(); addChoice(getText('sellItems'), function () { showSellItems(); }); addChoice(getText('findHouse'), function () { showFindHouse(); }); addChoice(getText('haveChildren'), function () { showHaveChildren(); }); addChoice(getText('visitParents'), function () { showVisitParents(); }); addChoice(getText('viewBelongings'), function () { showBelongingsMenu(); }); addChoice(getText('goBack'), function () { showExtrasMenu(); }); } function showSellItems() { var itemsValue = Math.floor(Math.random() * 800) + 200; playerMoney += itemsValue; playerHappiness -= 5; eventText.setText(getText('soldBelongings') + itemsValue + "!"); LK.getSound('success').play(); 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 + "!"); LK.getSound('success').play(); } else { eventText.setText(getText('notEnoughForHouse')); LK.getSound('failure').play(); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } function showHaveChildren() { if (playerRelationship === getText('single')) { eventText.setText(getText('needPartnerForChild')); LK.getSound('failure').play(); } else { playerChildren++; storage.playerChildren = playerChildren; monthlyChildExpenses += parseInt(getText('childExpenses')); storage.monthlyChildExpenses = monthlyChildExpenses; playerHappiness += 20; eventText.setText(getText('hadChild')); LK.getSound('success').play(); } clearChoices(); addChoice(getText('continue'), function () { playerMoney -= 50; advanceDay(); }); } function showVisitParents() { playerHappiness += 15; eventText.setText(getText('visitedParents')); LK.getSound('success').play(); 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')); LK.getSound('success').play(); 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 = {}; 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 = {}; updateUILanguage(); showMainMenu(); }); addChoice(currentLanguage === 'spanish' ? "No, cancelar" : "No, cancel", function () { showExtrasMenu(); }); } function checkAgeAndHealthGameOver() { updateStats(); if (checkGameOver()) { return; } checkDailyEvents(); } function checkDailyEvents() { updateStats(); if (checkGameOver()) { return; } showMainMenu(); } // Initialize the game if (showingLanguageMenu) { showLanguageMenu(); } else if (showingGenderMenu || playerGender === null) { showingGenderMenu = true; showGenderMenu(); } else { updateUILanguage(); showMainMenu(); }
===================================================================
--- original.js
+++ change.js
@@ -83,9 +83,13 @@
var playerJob = "Unemployed";
var playerSalary = 0;
var playerHappiness = 50;
var playerRelationship = "Single";
-var playerAge = 22;
+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;
@@ -223,9 +227,22 @@
ringName: "Diamond Ring",
playstationName: "PlayStation 5",
laptopName: "Gaming Laptop",
watchName: "Luxury Watch",
- bikeName: "Mountain Bike"
+ 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."
},
spanish: {
title: "Simulador de Vida: Camino al Éxito",
selectLanguage: "Select Language / Seleccionar Idioma",
@@ -317,9 +334,22 @@
ringName: "Anillo de Diamante",
playstationName: "PlayStation 5",
laptopName: "Laptop Gamer",
watchName: "Reloj de Lujo",
- bikeName: "Bicicleta de Montaña"
+ 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."
}
};
function getText(key) {
return translations[currentLanguage][key] || key;
@@ -546,8 +576,20 @@
var relationshipDisplay = game.addChild(new StatDisplay(getText('relationship'), getText('single'), 0xe91e63));
relationshipDisplay.x = 224;
relationshipDisplay.y = 550;
relationshipDisplay.updateValue(getText('single'), "");
+var ageDisplay = game.addChild(new StatDisplay(getText('age'), playerAge, 0x9b59b6));
+ageDisplay.x = 224;
+ageDisplay.y = 650;
+ageDisplay.updateValue(playerAge, "");
+var healthDisplay = game.addChild(new StatDisplay(getText('health'), playerHealth + "%", 0xe74c3c));
+healthDisplay.x = 224;
+healthDisplay.y = 750;
+healthDisplay.updateValue(playerHealth + "%", "");
+var nutritionDisplay = game.addChild(new StatDisplay(getText('nutrition'), playerNutrition + "%", 0x2ecc71));
+nutritionDisplay.x = 224;
+nutritionDisplay.y = 850;
+nutritionDisplay.updateValue(playerNutrition + "%", "");
// Event panel
var eventPanel = game.addChild(LK.getAsset('eventPanel', {
anchorX: 0.5,
anchorY: 0,
@@ -624,18 +666,44 @@
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));
+ ageDisplay.labelText.setText(getText('age') + ": " + playerAge);
+ healthDisplay.labelText.setText(getText('health') + ": " + playerHealth + "%");
+ 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, "");
+ ageDisplay.updateValue(playerAge, "");
+ healthDisplay.updateValue(playerHealth + "%", "");
+ nutritionDisplay.updateValue(playerNutrition + "%", "");
}
function checkGameOver() {
+ // Check age limit
+ if (playerAge >= maxAge) {
+ eventText.setText(getText('diedOfAge') + " " + playerAge + ". " + getText('gameOverAge'));
+ clearChoices();
+ LK.getSound('failure').play();
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 2000);
+ return true;
+ }
+ // Check health
+ if (playerHealth <= 0) {
+ eventText.setText(getText('diedOfHealth') + " " + playerAge + ". " + getText('gameOverHealth'));
+ clearChoices();
+ LK.getSound('failure').play();
+ LK.setTimeout(function () {
+ LK.showGameOver();
+ }, 2000);
+ return true;
+ }
if (playerMoney <= 0 && monthsUnemployed >= 3) {
eventText.setText(getText('gameOver'));
clearChoices();
LK.getSound('failure').play();
@@ -682,8 +750,31 @@
playerHappiness = Math.max(0, playerHappiness - 5);
playerMoney -= 50; // Daily expenses
advanceDay();
});
+ addChoice(getText('eatHealthy'), function () {
+ playerNutrition = Math.min(100, playerNutrition + 20);
+ playerHealth = Math.min(100, playerHealth + 5);
+ playerMoney -= 80; // Healthy food costs more
+ advanceDay();
+ });
+ addChoice(getText('eatJunk'), function () {
+ playerNutrition = Math.min(100, playerNutrition + 5);
+ playerHealth = Math.max(0, playerHealth - 2);
+ playerMoney -= 30; // Junk food is cheaper
+ advanceDay();
+ });
+ addChoice(getText('exercise'), function () {
+ playerHealth = Math.min(100, playerHealth + 10);
+ playerHappiness = Math.min(100, playerHappiness + 5);
+ playerMoney -= 40; // Gym membership or equipment costs
+ advanceDay();
+ });
+ addChoice(getText('rest'), function () {
+ playerHealth = Math.min(100, playerHealth + 15);
+ playerMoney -= 200; // Medical checkup cost
+ advanceDay();
+ });
addChoice(getText('extras'), function () {
showExtrasMenu();
});
}
@@ -885,8 +976,35 @@
});
}
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;
@@ -1106,9 +1224,11 @@
showMainMenu();
});
}
function showDetailedStats() {
- var statsText = currentLanguage === 'spanish' ? "Estadísticas detalladas:\n\nDía: " + dayCounter + "\nEdad: " + playerAge + "\nMeses desempleado: " + monthsUnemployed + "\nDinero total ganado: $" + Math.floor(dayCounter * 30) : "Detailed statistics:\n\nDay: " + dayCounter + "\nAge: " + playerAge + "\nMonths unemployed: " + monthsUnemployed + "\nTotal money earned: $" + Math.floor(dayCounter * 30);
+ 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();
@@ -1292,8 +1412,10 @@
playerSalary = 0;
playerHappiness = 50;
playerRelationship = getText('single');
playerAge = 22;
+ playerHealth = 100;
+ playerNutrition = 50;
monthsUnemployed = 0;
dayCounter = 1;
currentScene = "main";
playerHouse = false;
@@ -1301,8 +1423,11 @@
monthlyChildExpenses = 0;
playerBelongings = {};
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 = {};
@@ -1312,8 +1437,15 @@
addChoice(currentLanguage === 'spanish' ? "No, cancelar" : "No, cancel", function () {
showExtrasMenu();
});
}
+function checkAgeAndHealthGameOver() {
+ updateStats();
+ if (checkGameOver()) {
+ return;
+ }
+ checkDailyEvents();
+}
function checkDailyEvents() {
updateStats();
if (checkGameOver()) {
return;
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