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 = 22;
var monthsUnemployed = 0;
var dayCounter = 1;
var currentScene = "main";
var playerHouse = storage.playerHouse || false;
var playerChildren = storage.playerChildren || 0;
var monthlyChildExpenses = storage.monthlyChildExpenses || 0;
// 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"
},
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"
}
};
function getText(key) {
return translations[currentLanguage][key] || key;
}
// Job data with translations
var availableJobs = [{
nameEn: "Fast Food Worker",
nameEs: "Trabajador de Comida Rápida",
salary: 1200,
requirements: "None",
happiness: -5
}, {
nameEn: "Retail Associate",
nameEs: "Asociado de Ventas",
salary: 1400,
requirements: "None",
happiness: -3
}, {
nameEn: "Office Assistant",
nameEs: "Asistente de Oficina",
salary: 2000,
requirements: "High School",
happiness: 0
}, {
nameEn: "Bank Teller",
nameEs: "Cajero de Banco",
salary: 2800,
requirements: "Some Experience",
happiness: 5
}, {
nameEn: "Software Developer",
nameEs: "Desarrollador de Software",
salary: 5000,
requirements: "College Degree",
happiness: 15
}, {
nameEn: "Manager",
nameEs: "Gerente",
salary: 4200,
requirements: "Leadership Experience",
happiness: 10
}];
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'), "");
// 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));
}
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, "");
}
function checkGameOver() {
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('extras'), function () {
showExtrasMenu();
});
}
function showJobSearch() {
currentScene = "jobs";
eventText.setText(getText('availableJobs'));
clearChoices();
for (var i = 0; i < Math.min(3, availableJobs.length); i++) {
var job = availableJobs[i];
(function (jobData) {
addChoice(getJobName(jobData) + " ($" + jobData.salary + "/month)", function () {
applyForJob(jobData);
});
})(job);
}
addChoice(getText('goBack'), function () {
showMainMenu();
});
}
function applyForJob(job) {
var chance = Math.random();
if (chance > 0.3) {
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++;
// 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 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);
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('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 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;
monthsUnemployed = 0;
dayCounter = 1;
currentScene = "main";
playerHouse = false;
playerChildren = 0;
monthlyChildExpenses = 0;
storage.language = currentLanguage;
storage.gender = playerGender;
storage.playerHouse = false;
storage.playerChildren = 0;
storage.monthlyChildExpenses = 0;
updateUILanguage();
showMainMenu();
});
addChoice(currentLanguage === 'spanish' ? "No, cancelar" : "No, cancel", 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();
} ===================================================================
--- original.js
+++ change.js
@@ -87,8 +87,11 @@
var playerAge = 22;
var monthsUnemployed = 0;
var dayCounter = 1;
var currentScene = "main";
+var playerHouse = storage.playerHouse || false;
+var playerChildren = storage.playerChildren || 0;
+var monthlyChildExpenses = storage.monthlyChildExpenses || 0;
// Translations
var translations = {
english: {
title: "Life Simulator: Rise to Success",
@@ -151,9 +154,26 @@
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"
+ 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"
},
spanish: {
title: "Simulador de Vida: Camino al Éxito",
selectLanguage: "Select Language / Seleccionar Idioma",
@@ -215,9 +235,26 @@
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"
+ 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"
}
};
function getText(key) {
return translations[currentLanguage][key] || key;
@@ -635,10 +672,16 @@
function advanceDay() {
dayCounter++;
// Monthly salary
if (dayCounter % 30 === 0 && playerJob !== getText('unemployed')) {
- playerMoney += playerSalary;
- eventText.setText(getText('payday') + playerSalary + (currentLanguage === 'spanish' ? " de tu trabajo como " + playerJob : " from your job as " + playerJob));
+ 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();
});
@@ -840,8 +883,11 @@
});
addChoice(currentLanguage === 'spanish' ? "Reiniciar juego" : "Reset game", function () {
resetGame();
});
+ addChoice(getText('lifeOptions'), function () {
+ showLifeOptionsMenu();
+ });
addChoice(getText('goBack'), function () {
showMainMenu();
});
}
@@ -876,8 +922,88 @@
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('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 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 () {
@@ -890,10 +1016,16 @@
playerAge = 22;
monthsUnemployed = 0;
dayCounter = 1;
currentScene = "main";
+ playerHouse = false;
+ playerChildren = 0;
+ monthlyChildExpenses = 0;
storage.language = currentLanguage;
storage.gender = playerGender;
+ storage.playerHouse = false;
+ storage.playerChildren = 0;
+ storage.monthlyChildExpenses = 0;
updateUILanguage();
showMainMenu();
});
addChoice(currentLanguage === 'spanish' ? "No, cancelar" : "No, cancel", function () {
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