User prompt
sarı yazıyı en ön plana çıkart
User prompt
Please fix the bug: 'Cannot set properties of undefined (setting 'visible')' in or related to this line: 'warningBox.visible = true;' Line Number: 1798
User prompt
siyah kutuyu çerçeve olarak kabul et ve yazıyı onun içerisine sığdır satır olarak alta kayabilirsin ve bu uyarı sadece giriş ekranında gözüksün
User prompt
alttaki sarı yazıyı 0.25x daha büyüt ve siyah kutunun içine sığdır kenarlardan taşmasın
User prompt
giriş sayfasındaki yazıları 0.25x büyüt
User prompt
This game is still in development and not quite playable yet, but I’d love for you to check it out anyway. If it gets enough attention, I’ll speed up the development process. (Please display this message inside a box, with yellow text and a 0.25x-thick border.)
User prompt
This game is still in development and not quite playable yet, but I’d love for you to check it out anyway. If it gets enough attention, I’ll speed up the development process. (Please display this message inside a box, with yellow text and a 0.25x-thick border.)
User prompt
En alta bu oyun henüz geliştirilme aşamasında şuan oynamaya pek müsait değil fakat yine de bir gözden geçirmenizi istedim. eğer yeterince beğeni alırsa oyunun geliştirilme sürecini hızlandıracağım. (sarı yazıyla yaz 0.25x kalınlığında çerçeve ekle)
User prompt
Oyuna bir giriş ekranı ekle Ekranın üst kısmında oyunun özeti yazsın alt kısımlara doğru mekaniklerinden bahset ve en alta play butonu koy play butonuna bastıktan sonra oyun başlar
User prompt
ADD STUDIO too
User prompt
ADD THE COMING SOON WRITE IN HOTEL PAGE
User prompt
SADECE BREAD APPLE FALAN YAZSIN PARALARI ALTTA YAZSIN
User prompt
bread apple water bottle full meal energy drink yazılarının yanındaki paraları sil
User prompt
arka plan müziği süresi bittiğinde rastgele saniyelerde başlasın mesela süresi dolduğunda tekrar çalmaya başladığında 8 inci saniyeden başlasın sonra tekrar bittiğinde tekrardan random bir süreden çalmaya başlasın
User prompt
arka plan müziği sürekli çalsın (1) isimli olan
User prompt
next day butonunu kaldır
User prompt
level up butonunu kaldır
User prompt
1.5 to 2
User prompt
saati 1.5 x hızlandır
User prompt
etrafına 0.25 kalınlığında siyah çerçeve ekle
User prompt
2X KÜÇÜLT
User prompt
PARA VE FOLLOWERS I SARI YAZ 3X BÜYÜT
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'fontSize')' in or related to this line: 'musicButtonText.style.fontSize = textSize;' Line Number: 1128
User prompt
YAN TARAFLARINDAKİ PARA YAZILARINI SİL
User prompt
fiyatlarını altına yaz
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var ActionButton = Container.expand(function (text, action, assetType) {
var self = Container.call(this);
var buttonAsset = assetType || 'performButton';
var button = self.attachAsset(buttonAsset, {
anchorX: 0.5,
anchorY: 0.5
});
// Calculate appropriate text size based on text length to fit within button
var textSize;
if (text.length > 20) {
textSize = 28;
} else if (text.length > 15) {
textSize = 32;
} else {
textSize = 40;
}
var buttonText = new Text2(text, {
size: textSize,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
buttonText.anchor.set(0.5, 0.5);
buttonText.x = 0;
buttonText.y = 0;
self.addChild(buttonText);
self.action = action;
self.down = function (x, y, obj) {
if (self.action) {
self.action();
}
};
return self;
});
var CollapsibleWindow = Container.expand(function () {
var self = Container.call(this);
// Create window background
var windowBg = self.attachAsset('tabBackground', {
anchorX: 1,
anchorY: 0.5
});
// Create handle for toggle - positioned at screen edge
var handle = self.attachAsset('tabHandle', {
anchorX: 1,
anchorY: 0.5,
x: 0,
y: 0
});
// Add handle text
var handleText = new Text2('NAV', {
size: 20,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif"
});
handleText.anchor.set(0.5, 0.5);
handleText.x = -15;
handleText.y = 0;
handle.addChild(handleText);
self.isOpen = false;
self.buttons = [];
// Toggle window open/closed
self.toggle = function () {
self.isOpen = !self.isOpen;
var targetX = self.isOpen ? 0 : windowBg.width;
var handleTargetX = self.isOpen ? -windowBg.width + 125 : 0;
tween(windowBg, {
x: targetX
}, {
duration: 500,
easing: tween.easeInOut
});
tween(handle, {
x: handleTargetX
}, {
duration: 500,
easing: tween.easeInOut
});
// Update button visibility
for (var i = 0; i < self.buttons.length; i++) {
self.buttons[i].visible = self.isOpen;
}
};
// Add navigation button to window
self.addNavButton = function (text, targetLocation, assetType, yOffset) {
var button = new NavigationButton(text, targetLocation, assetType);
button.x = -200;
button.y = yOffset;
button.scaleX = 1.3;
button.scaleY = 1.3;
button.visible = false;
windowBg.addChild(button);
self.buttons.push(button);
return button;
};
// Handle click on handle
handle.down = function (x, y, obj) {
self.toggle();
};
// Initially closed - position completely off-screen
windowBg.x = windowBg.width;
return self;
});
var Location = Container.expand(function (type, name, earningMultiplier, cost) {
var self = Container.call(this);
self.type = type;
self.name = name;
self.earningMultiplier = earningMultiplier;
self.cost = cost;
self.unlocked = type === 'street';
var locationGraphics = self.attachAsset(type, {
anchorX: 0.5,
anchorY: 0.5
});
var nameText = new Text2(name, {
size: 24,
fill: 0xFFFFFF
});
nameText.anchor.set(0.5, 0);
nameText.x = 0;
nameText.y = locationGraphics.height / 2 + 10;
self.addChild(nameText);
self.down = function (x, y, obj) {
if (self.unlocked) {
selectLocation(self);
}
};
return self;
});
var Musician = Container.expand(function () {
var self = Container.call(this);
// Add lower body/pelvis below upper body - created first to be behind upper body
var lowerBody = self.attachAsset('musicianLowerBody', {
anchorX: 0.5,
anchorY: 0,
x: 0,
y: 55,
rotation: -0.175 // 10 degrees left rotation in radians
});
// Main upper body - centered as the base - created after lower body to be in front
var upperBody = self.attachAsset('musicianUpperBody', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -50
});
// Add head positioned above upper body
var head = self.attachAsset('musicianHead', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -180
});
// Add left arm positioned at shoulder level
self.leftArm = self.attachAsset('musicianLeftArm', {
anchorX: 0.5,
anchorY: 0,
x: -110,
y: -135
});
// Add right arm positioned at shoulder level
self.rightArm = self.attachAsset('musicianRightArm', {
anchorX: 0.5,
anchorY: 0,
x: 110,
y: -135
});
// Add left calf attached directly to lower body
var leftCalf = lowerBody.attachAsset('musicianCalf', {
anchorX: 0.5,
anchorY: 0,
x: 47.5,
y: 70,
rotation: 0.8
// Angled downward for sitting position
});
// Add left foot attached to calf at ankle
var leftFoot = leftCalf.attachAsset('musicianFoot', {
anchorX: 0.5,
anchorY: 0,
x: 115,
y: 95,
rotation: 1.2
// Angled for natural foot position
});
// Add right calf attached directly to lower body
var rightCalf = lowerBody.attachAsset('musicianCalf', {
anchorX: 0.5,
anchorY: 0,
x: -27.5,
y: 70,
rotation: 0.8
// Angled downward for sitting position
});
// Add right foot attached to calf at ankle
var rightFoot = rightCalf.attachAsset('musicianFoot', {
anchorX: 0.5,
anchorY: 0,
x: 105,
y: 95,
rotation: 1.2
// Angled for natural foot position
});
// Add left hand positioned at the end of left arm
self.leftHand = self.leftArm.attachAsset('leftHand', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 200
});
// Add right hand positioned at the end of right arm
self.rightHand = self.rightArm.attachAsset('rightHand', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 210
});
// Position guitar next to bench, leaning against it
var guitar = self.attachAsset('guitar', {
anchorX: 0.5,
anchorY: 1,
x: 200,
y: 150
});
self.perform = function () {
// Only play sound if no sound is currently playing
if (!currentlyPlayingMusic) {
currentlyPlayingMusic = 'music1';
LK.getSound('music1').play();
// Guitar playing animation - move arms to simulate playing
var originalLeftArmRotation = self.leftArm.rotation;
var originalRightArmRotation = self.rightArm.rotation;
// Animate left arm (chord hand)
tween(self.leftArm, {
rotation: originalLeftArmRotation + 0.2
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.leftArm, {
rotation: originalLeftArmRotation - 0.1
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.leftArm, {
rotation: originalLeftArmRotation
}, {
duration: 200,
easing: tween.easeInOut
});
}
});
}
});
// Animate right arm (strumming hand)
tween(self.rightArm, {
rotation: originalRightArmRotation - 0.3
}, {
duration: 150,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.rightArm, {
rotation: originalRightArmRotation + 0.2
}, {
duration: 250,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.rightArm, {
rotation: originalRightArmRotation - 0.1
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.rightArm, {
rotation: originalRightArmRotation
}, {
duration: 150,
easing: tween.easeInOut
});
}
});
}
});
}
});
// Set timeout to reset currentlyPlayingMusic after sound duration
LK.setTimeout(function () {
currentlyPlayingMusic = null;
// Update music button states when music finishes
if (musicListOpen) {
for (var i = 0; i < musicButtons.length; i++) {
var targetAlpha = musicOptions[i].locked ? 0.5 : 1;
tween(musicButtons[i], {
alpha: targetAlpha
}, {
duration: 300
});
}
}
}, 2500); // Approximate duration of sound
}
};
self.performWithMusic = function (musicId) {
// Only play sound if no sound is currently playing
if (!currentlyPlayingMusic) {
currentlyPlayingMusic = musicId;
LK.getSound(musicId).play();
// Guitar playing animation - move arms to simulate playing
var originalLeftArmRotation = self.leftArm.rotation;
var originalRightArmRotation = self.rightArm.rotation;
// Animate left arm (chord hand)
tween(self.leftArm, {
rotation: originalLeftArmRotation + 0.2
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.leftArm, {
rotation: originalLeftArmRotation - 0.1
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.leftArm, {
rotation: originalLeftArmRotation
}, {
duration: 200,
easing: tween.easeInOut
});
}
});
}
});
// Animate right arm (strumming hand)
tween(self.rightArm, {
rotation: originalRightArmRotation - 0.3
}, {
duration: 150,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.rightArm, {
rotation: originalRightArmRotation + 0.2
}, {
duration: 250,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.rightArm, {
rotation: originalRightArmRotation - 0.1
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(self.rightArm, {
rotation: originalRightArmRotation
}, {
duration: 150,
easing: tween.easeInOut
});
}
});
}
});
}
});
// Set timeout to reset currentlyPlayingMusic after sound duration
LK.setTimeout(function () {
currentlyPlayingMusic = null;
// Update music button states when music finishes
if (musicListOpen) {
for (var i = 0; i < musicButtons.length; i++) {
var targetAlpha = musicOptions[i].locked ? 0.5 : 1;
tween(musicButtons[i], {
alpha: targetAlpha
}, {
duration: 300
});
}
}
}, 2500); // Approximate duration of sound
}
};
return self;
});
var NPC = Container.expand(function () {
var self = Container.call(this);
var npcGraphics = self.attachAsset('npc', {
anchorX: 0.5,
anchorY: 1
});
// Add continuous movement animation
self.startMovement = function () {
// Add floating animation - vertical movement
tween(self, {
y: self.y - 20
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Float down
tween(self, {
y: self.y + 40
}, {
duration: 3000,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Return to center and repeat
tween(self, {
y: self.y - 20
}, {
duration: 1500,
easing: tween.easeInOut,
onFinish: function onFinish() {
self.startMovement(); // Loop the animation
}
});
}
});
}
});
};
// Stop NPC animation
self.stopMovement = function () {
tween.stop(self);
};
return self;
});
var NavigationButton = Container.expand(function (text, targetLocation, assetType) {
var self = Container.call(this);
var button = self.attachAsset(assetType, {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.6,
scaleY: 0.6
});
var buttonText = new Text2(text, {
size: 24,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif"
});
buttonText.anchor.set(0.5, 0.5);
buttonText.x = 0;
buttonText.y = 0;
self.addChild(buttonText);
self.targetLocation = targetLocation;
self.down = function (x, y, obj) {
navigateToLocation(self.targetLocation);
};
return self;
});
var ResourceBar = Container.expand(function (label, color, maxValue) {
var self = Container.call(this);
self.maxValue = maxValue;
self.currentValue = maxValue;
var bg = self.attachAsset('resourceBg', {
anchorX: 0,
anchorY: 0,
width: 314,
height: 54
});
var bar = self.attachAsset('resourceBar', {
anchorX: 0,
anchorY: 0,
x: 2,
y: 2,
width: 310,
height: 50
});
bar.tint = color;
self.bar = bar;
// Add percentage text centered in the bar
var valueText = new Text2('100%', {
size: 36,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif",
stroke: 0x000000,
strokeThickness: 9
});
valueText.anchor.set(0.5, 0.5);
valueText.x = 157;
valueText.y = 27;
self.addChild(valueText);
self.valueText = valueText;
self.updateBar = function () {
var percentage = Math.max(0, self.currentValue / self.maxValue);
self.bar.width = 310 * percentage;
self.bar.height = 50;
self.valueText.setText(Math.round(percentage * 100) + '%');
if (percentage < 0.3) {
self.bar.tint = 0xFF0000;
} else if (percentage < 0.6) {
self.bar.tint = 0xFFFF00;
} else {
self.bar.tint = color;
}
};
self.setValue = function (value) {
self.currentValue = Math.max(0, Math.min(self.maxValue, value));
self.updateBar();
};
self.addValue = function (amount) {
self.setValue(self.currentValue + amount);
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game state variables
var currentDay = storage.currentDay || 0;
var money = storage.money || 10;
var followers = storage.followers || 0;
var concerts = storage.concerts || 0;
var musicSkill = storage.musicSkill || 10;
var equipmentLevel = storage.equipmentLevel || 1;
var socialMediaUnlocked = storage.socialMediaUnlocked || false;
var playerLevel = storage.playerLevel || 1;
// Clock variables
var currentHour = 0; // Start at 12:00 AM (midnight)
var currentMinute = 0;
var timeSpeed = 1.5; // How fast time moves (1.5 = 1.5x faster than normal speed)
var dayLightLevel = 0.5; // Controls background brightness based on time
// Resources
var foodLevel = 100;
var waterLevel = 100;
var healthLevel = 100;
var moodLevel = 80;
var sleepLevel = 80;
// Game state
var currentLocation = null;
var gamePhase = 'playing'; // 'playing', 'gameOver', 'won'
var resourceDrainTimer = 0;
// UI Elements
var dayText = new Text2('Day 0', {
size: 50,
fill: 0x000000
});
dayText.anchor.set(0, 0);
dayText.x = 80;
dayText.y = 65;
LK.gui.top.addChild(dayText);
var moneyText = new Text2('$10', {
size: 45,
fill: 0xFFFF00,
stroke: 0x000000,
strokeThickness: 0.25
});
moneyText.anchor.set(1, 0);
moneyText.x = -20;
moneyText.y = 60;
LK.gui.topRight.addChild(moneyText);
var followersText = new Text2('Followers: 0', {
size: 37.5,
fill: 0xFFFF00,
stroke: 0x000000,
strokeThickness: 0.25
});
followersText.anchor.set(0, 0);
followersText.x = 20;
followersText.y = 60;
LK.gui.topLeft.addChild(followersText);
// Create clock display
var clockContainer = LK.gui.top.addChild(new Container());
clockContainer.x = -135;
clockContainer.y = 25;
// Clock face
var clockFace = clockContainer.addChild(LK.getAsset('clockFace', {
anchorX: 0.5,
anchorY: 0.5,
x: 60,
y: 60
}));
// Hour hand
var hourHand = clockContainer.addChild(LK.getAsset('clockHour', {
anchorX: 0.5,
anchorY: 1,
x: 60,
y: 60
}));
// Minute hand
var minuteHand = clockContainer.addChild(LK.getAsset('clockMinute', {
anchorX: 0.5,
anchorY: 1,
x: 60,
y: 60
}));
// Clock center dot
var clockCenter = clockContainer.addChild(LK.getAsset('clockCenter', {
anchorX: 0.5,
anchorY: 0.5,
x: 60,
y: 60
}));
// Time text display
var timeText = new Text2('12:00 AM', {
size: 28,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
timeText.anchor.set(0.5, 0);
timeText.x = 60;
timeText.y = 140;
clockContainer.addChild(timeText);
// Create time-based backgrounds with different assets
var morningBackground = game.addChild(LK.getAsset('morningBg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
var noonBackground = game.addChild(LK.getAsset('noonBg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
visible: false
}));
var eveningBackground = game.addChild(LK.getAsset('eveningBg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
visible: false
}));
var nightBackground = game.addChild(LK.getAsset('nightBg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
visible: false
}));
// Create floor behind lamp and musician
var floor = game.addChild(LK.getAsset('floor', {
anchorX: 0,
anchorY: 1,
x: 0,
y: 2832 - 150
}));
// Create resource bars arranged side by side
var barStartX = 200;
var barSpacing = 320;
var barY = 330;
var foodBar = new ResourceBar('', 0x32CD32, 100);
foodBar.x = barStartX;
foodBar.y = barY;
game.addChild(foodBar);
var waterBar = new ResourceBar('', 0x1E90FF, 100);
waterBar.x = barStartX + barSpacing;
waterBar.y = barY;
game.addChild(waterBar);
var healthBar = new ResourceBar('', 0xFF6347, 100);
healthBar.x = barStartX + barSpacing * 2;
healthBar.y = barY;
game.addChild(healthBar);
var moodBar = new ResourceBar('', 0xFFD700, 100);
moodBar.x = barStartX + barSpacing * 3;
moodBar.y = barY;
game.addChild(moodBar);
var sleepBar = new ResourceBar('', 0x9370DB, 100);
sleepBar.x = barStartX + barSpacing * 4;
sleepBar.y = barY;
game.addChild(sleepBar);
// Add labels below the bars
var foodLabel = new Text2('Food', {
size: 36,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif",
stroke: 0x000000,
strokeThickness: 9
});
foodLabel.anchor.set(0.5, 0);
foodLabel.x = barStartX + 152;
foodLabel.y = barY + 50;
game.addChild(foodLabel);
var waterLabel = new Text2('Water', {
size: 36,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif",
stroke: 0x000000,
strokeThickness: 9
});
waterLabel.anchor.set(0.5, 0);
waterLabel.x = barStartX + barSpacing + 152;
waterLabel.y = barY + 50;
game.addChild(waterLabel);
var healthLabel = new Text2('Health', {
size: 36,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif",
stroke: 0x000000,
strokeThickness: 9
});
healthLabel.anchor.set(0.5, 0);
healthLabel.x = barStartX + barSpacing * 2 + 152;
healthLabel.y = barY + 50;
game.addChild(healthLabel);
var moodLabel = new Text2('Mood', {
size: 36,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif",
stroke: 0x000000,
strokeThickness: 9
});
moodLabel.anchor.set(0.5, 0);
moodLabel.x = barStartX + barSpacing * 3 + 152;
moodLabel.y = barY + 50;
game.addChild(moodLabel);
var sleepLabel = new Text2('Sleep', {
size: 36,
fill: 0xFFFFFF,
font: "'Arial Black','Arial',sans-serif",
stroke: 0x000000,
strokeThickness: 9
});
sleepLabel.anchor.set(0.5, 0);
sleepLabel.x = barStartX + barSpacing * 4 + 152;
sleepLabel.y = barY + 50;
game.addChild(sleepLabel);
// Create location reference for current gameplay
var streetCorner = new Location('streetCorner', 'Street Corner', 1.0, 0);
// Create sitting bench at musician's current position
var sittingBench = game.addChild(LK.getAsset('sittingBench', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 2170
}));
// Create musician
var musician = new Musician();
musician.x = 1024; // Center horizontally (2048/2)
musician.y = 2070; // Position musician to sit properly on the bench
game.addChild(musician);
// Scale musician to 1.15x
tween(musician, {
scaleX: 1.15,
scaleY: 1.15
}, {
duration: 500,
easing: tween.easeOut
});
// Music selection state
var musicListOpen = false;
var currentlyPlayingMusic = null; // Track currently playing music
var musicOptions = [{
name: 'Music 1',
cost: 5,
sound: 'music1',
requiredLevel: 1,
locked: false
}, {
name: 'Music 2',
cost: 8,
sound: 'music2',
requiredLevel: 2,
locked: true
}, {
name: 'Music 3',
cost: 10,
sound: 'music3',
requiredLevel: 3,
locked: true
}, {
name: 'Music 4',
cost: 12,
sound: 'music4',
requiredLevel: 4,
locked: true
}, {
name: 'Music 5',
cost: 15,
sound: 'music5',
requiredLevel: 5,
locked: true
}];
var musicButtons = [];
// Create action buttons
var performButton = new ActionButton('Sound Menu', function () {
toggleMusicList();
});
performButton.x = 250;
performButton.y = 800;
game.addChild(performButton);
// Create music selection buttons (initially hidden)
for (var i = 0; i < musicOptions.length; i++) {
var buttonText = musicOptions[i].locked ? musicOptions[i].name + ' (LOCKED)' : musicOptions[i].name + ' ($' + musicOptions[i].cost + ')';
var musicButton = new ActionButton(buttonText, createMusicAction(i));
musicButton.x = 250;
musicButton.y = 900 + i * 120; // Increased spacing from 100 to 120
musicButton.visible = false;
// Visual indication for locked music
if (musicOptions[i].locked) {
musicButton.alpha = 0.5;
}
musicButtons.push(musicButton);
game.addChild(musicButton);
}
function createMusicAction(index) {
return function () {
// Check if any music is currently playing
if (currentlyPlayingMusic) {
// Show message that music is already playing
var playingText = new Text2('Music is already playing!', {
size: 30,
fill: 0xFF0000
});
playingText.anchor.set(0.5, 0.5);
playingText.x = 1024;
playingText.y = 1200;
game.addChild(playingText);
tween(playingText, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
playingText.destroy();
}
});
return;
}
if (musicOptions[index].locked) {
// Show locked message
var lockedText = new Text2('Reach Level ' + musicOptions[index].requiredLevel + ' to unlock!', {
size: 30,
fill: 0xFF0000
});
lockedText.anchor.set(0.5, 0.5);
lockedText.x = 1024;
lockedText.y = 1200;
game.addChild(lockedText);
tween(lockedText, {
alpha: 0
}, {
duration: 2000,
onFinish: function onFinish() {
lockedText.destroy();
}
});
return;
}
// Animate character reaching for and holding guitar when any music button is pressed
var guitar = null;
for (var i = 0; i < musician.children.length; i++) {
if (musician.children[i].texture && musician.children[i].texture.baseTexture && musician.children[i].texture.baseTexture.resource && musician.children[i].texture.baseTexture.resource.url && musician.children[i].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = musician.children[i];
break;
}
}
if (!guitar) {
// If guitar asset not found in musician children, look for it by checking all children
for (var i = 0; i < musician.children.length; i++) {
var child = musician.children[i];
if (child.children) {
for (var j = 0; j < child.children.length; j++) {
if (child.children[j].texture && child.children[j].texture.baseTexture && child.children[j].texture.baseTexture.resource && child.children[j].texture.baseTexture.resource.url && child.children[j].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = child.children[j];
break;
}
}
}
}
}
// If still not found, get the guitar from the game scene
if (!guitar) {
for (var i = 0; i < game.children.length; i++) {
if (game.children[i].texture && game.children[i].texture.baseTexture && game.children[i].texture.baseTexture.resource && game.children[i].texture.baseTexture.resource.url && game.children[i].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = game.children[i];
break;
}
}
}
if (guitar && currentLocation && money >= musicOptions[index].cost) {
// First, animate musician reaching for guitar - left arm extends toward guitar
tween(musician.leftArm, {
rotation: -0.2,
x: -80,
y: -120
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
// After reaching, animate guitar to left hand position
tween(guitar, {
x: musician.x - 50,
y: musician.y - 50,
rotation: -0.3
}, {
duration: 300,
easing: tween.easeOut
});
// Animate left arm to hold guitar neck
tween(musician.leftArm, {
rotation: -0.5,
x: -80,
y: -120
}, {
duration: 300,
easing: tween.easeOut
});
// Animate right arm to playing position
tween(musician.rightArm, {
rotation: 0.3,
x: 80,
y: -100
}, {
duration: 300,
easing: tween.easeOut
});
// Perform the music after animation completes
performMusic(musicOptions[index]);
toggleMusicList(); // Close the list after selection
}
});
} else if (currentLocation && money >= musicOptions[index].cost) {
performMusic(musicOptions[index]);
toggleMusicList(); // Close the list after selection
}
};
}
function toggleMusicList() {
musicListOpen = !musicListOpen;
// Animate music buttons visibility
for (var i = 0; i < musicButtons.length; i++) {
if (musicListOpen) {
musicButtons[i].visible = true;
musicButtons[i].alpha = 0;
// Set appropriate alpha based on music playing state and locked state
var targetAlpha = 1;
if (currentlyPlayingMusic || musicOptions[i].locked) {
targetAlpha = 0.3; // More transparent when disabled
}
tween(musicButtons[i], {
alpha: targetAlpha,
y: 900 + i * 120
}, {
duration: 300,
easing: tween.easeOut
});
} else {
tween(musicButtons[i], {
alpha: 0,
y: 800
}, {
duration: 300,
easing: tween.easeIn,
onFinish: function onFinish() {
for (var j = 0; j < musicButtons.length; j++) {
musicButtons[j].visible = false;
}
}
});
}
}
// When opening music list, animate character reaching for and holding guitar
if (musicListOpen) {
// Find the guitar asset in the musician
var guitar = null;
for (var i = 0; i < musician.children.length; i++) {
if (musician.children[i].texture && musician.children[i].texture.baseTexture && musician.children[i].texture.baseTexture.resource && musician.children[i].texture.baseTexture.resource.url && musician.children[i].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = musician.children[i];
break;
}
}
if (!guitar) {
// If guitar asset not found in musician children, look for it by checking all children
for (var i = 0; i < musician.children.length; i++) {
var child = musician.children[i];
if (child.children) {
for (var j = 0; j < child.children.length; j++) {
if (child.children[j].texture && child.children[j].texture.baseTexture && child.children[j].texture.baseTexture.resource && child.children[j].texture.baseTexture.resource.url && child.children[j].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = child.children[j];
break;
}
}
}
}
}
// If still not found, get the guitar from the game scene
if (!guitar) {
for (var i = 0; i < game.children.length; i++) {
if (game.children[i].texture && game.children[i].texture.baseTexture && game.children[i].texture.baseTexture.resource && game.children[i].texture.baseTexture.resource.url && game.children[i].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = game.children[i];
break;
}
}
}
if (guitar) {
// First, animate musician reaching for guitar - left arm extends toward guitar
tween(musician.leftArm, {
rotation: -0.2,
x: -80,
y: -120
}, {
duration: 300,
easing: tween.easeOut,
onFinish: function onFinish() {
// After reaching, animate guitar to left hand position
tween(guitar, {
x: musician.x - 50,
y: musician.y - 50,
rotation: -0.3
}, {
duration: 300,
easing: tween.easeOut
});
// Animate left arm to hold guitar neck
tween(musician.leftArm, {
rotation: -0.5,
x: -80,
y: -120
}, {
duration: 300,
easing: tween.easeOut
});
// Animate right arm to playing position
tween(musician.rightArm, {
rotation: 0.3,
x: 80,
y: -100
}, {
duration: 300,
easing: tween.easeOut
});
}
});
}
} else {
// When closing music list, return guitar and arms to original positions
var guitar = null;
for (var i = 0; i < game.children.length; i++) {
if (game.children[i].texture && game.children[i].texture.baseTexture && game.children[i].texture.baseTexture.resource && game.children[i].texture.baseTexture.resource.url && game.children[i].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = game.children[i];
break;
}
}
if (guitar) {
// Return guitar to original position
tween(guitar, {
x: musician.x + 200,
y: musician.y + 150,
rotation: 0
}, {
duration: 500,
easing: tween.easeOut
});
// Return left arm to original position
tween(musician.leftArm, {
rotation: 0,
x: -110,
y: -135
}, {
duration: 500,
easing: tween.easeOut
});
// Return right arm to original position
tween(musician.rightArm, {
rotation: 0,
x: 110,
y: -135
}, {
duration: 500,
easing: tween.easeOut
});
}
}
}
var levelUpButton = new ActionButton('Level Up ($50)', function () {
if (money >= 50) {
money -= 50;
equipmentLevel++;
musicSkill += 10;
playerLevel++;
// Unlock music tracks based on level
for (var i = 0; i < musicOptions.length; i++) {
if (playerLevel >= musicOptions[i].requiredLevel) {
musicOptions[i].locked = false;
}
}
// Update music button text and appearance
for (var i = 0; i < musicButtons.length; i++) {
var buttonText = musicOptions[i].locked ? musicOptions[i].name + ' (LOCKED)' : musicOptions[i].name + ' ($' + musicOptions[i].cost + ')';
var musicButtonText = musicButtons[i].children[1];
musicButtonText.setText(buttonText);
// Adjust text size if too long
var textSize = buttonText.length > 15 ? 36 : 48;
musicButtonText.style.fontSize = textSize;
musicButtons[i].alpha = musicOptions[i].locked ? 0.5 : 1;
}
// Save to storage for persistence
storage.money = money;
storage.equipmentLevel = equipmentLevel;
storage.musicSkill = musicSkill;
storage.playerLevel = playerLevel;
// Update button text to show new cost
var buttonText = levelUpButton.children[1];
buttonText.setText('Level Up ($' + (50 + equipmentLevel * 25) + ')');
// Show level up effect
showEarnings(0); // Reuse the earnings animation system
var levelUpText = new Text2('LEVEL UP!', {
size: 40,
fill: 0xFF0000
});
levelUpText.anchor.set(0.5, 0.5);
levelUpText.x = musician.x;
levelUpText.y = musician.y - 200;
game.addChild(levelUpText);
tween(levelUpText, {
y: levelUpText.y - 50,
alpha: 0
}, {
duration: 1500,
onFinish: function onFinish() {
levelUpText.destroy();
}
});
updateDisplay();
}
});
levelUpButton.x = 1450;
levelUpButton.y = 700;
game.addChild(levelUpButton);
var nextDayButton = new ActionButton('Next Day', function () {
// Sounds stop automatically, no need to stop manually
nextDay();
});
nextDayButton.x = 1450;
nextDayButton.y = 800;
game.addChild(nextDayButton);
// Set initial location
currentLocation = streetCorner;
selectLocation(streetCorner);
// Create street lamp
var streetLamp = game.addChild(LK.getAsset('streetLamp', {
anchorX: 0.5,
anchorY: 1,
x: 300,
y: 2632 - 150
}));
// Add lamp light glow effect
var lampGlow = game.addChild(LK.getAsset('lampGlow', {
anchorX: 1.5,
anchorY: 1.5,
x: 400,
y: 2350 - 150 - 230
}));
lampGlow.alpha = 0.3;
function selectLocation(location) {
if (!location.unlocked) {
return;
}
currentLocation = location;
// Update perform button cost
var buttonText = performButton.children[1];
buttonText.setText('Sound Menu');
}
function performMusic(musicOption) {
var cost = musicOption ? musicOption.cost : currentLocation ? currentLocation.cost : 0;
if (currentLocation && money >= cost && sleepLevel > 20) {
money -= cost;
// Calculate performance quality
var performance = calculatePerformance();
var baseEarnings = Math.floor(performance * currentLocation.earningMultiplier * (5 + Math.random() * 15));
var bonusEarnings = musicOption ? Math.floor(musicOption.cost * 0.5) : 0; // Bonus for using premium music
var totalEarnings = baseEarnings + bonusEarnings;
money += totalEarnings;
musicSkill += 1;
sleepLevel = Math.max(0, sleepLevel - 15);
moodLevel = Math.min(100, moodLevel + 5);
// Save money to storage for persistence
storage.money = money;
storage.totalEarnings = (storage.totalEarnings || 0) + totalEarnings;
// Police encounter chance
if (currentLocation.type === 'streetCorner' && Math.random() < 0.15) {
policeEncounter();
}
// Social media followers (after day 10)
if (currentDay >= 10 && !socialMediaUnlocked) {
socialMediaUnlocked = true;
}
if (socialMediaUnlocked && performance > 0.7) {
var newFollowers = Math.floor(performance * 10 * currentLocation.earningMultiplier);
followers += newFollowers;
}
if (musicOption && musicOption.sound) {
musician.performWithMusic(musicOption.sound);
} else {
musician.perform();
}
LK.getSound('coinDrop').play();
// Show earnings
showEarnings(totalEarnings);
updateDisplay();
checkWinConditions();
// Set timeout to return guitar to original position when music ends
LK.setTimeout(function () {
var guitar = null;
for (var i = 0; i < game.children.length; i++) {
if (game.children[i].texture && game.children[i].texture.baseTexture && game.children[i].texture.baseTexture.resource && game.children[i].texture.baseTexture.resource.url && game.children[i].texture.baseTexture.resource.url.indexOf('guitar') !== -1) {
guitar = game.children[i];
break;
}
}
if (guitar) {
// Return guitar to original position
tween(guitar, {
x: musician.x + 200,
y: musician.y + 150,
rotation: 0
}, {
duration: 500,
easing: tween.easeOut
});
// Return left arm to original position
tween(musician.leftArm, {
rotation: 0,
x: -110,
y: -135
}, {
duration: 500,
easing: tween.easeOut
});
// Return right arm to original position
tween(musician.rightArm, {
rotation: 0,
x: 110,
y: -135
}, {
duration: 500,
easing: tween.easeOut
});
}
}, 2500); // Return guitar after music ends
}
}
function calculatePerformance() {
var base = musicSkill / 100;
var moodBonus = moodLevel / 100 * 0.3;
var sleepBonus = sleepLevel / 100 * 0.2;
var equipmentBonus = equipmentLevel * 0.1;
return Math.min(1.0, base + moodBonus + sleepBonus + equipmentBonus);
}
function policeEncounter() {
LK.getSound('policeSiren').play();
var officer = game.addChild(LK.getAsset('policeOfficer', {
anchorX: 0.5,
anchorY: 1,
x: musician.x + 100,
y: musician.y
}));
var fine = Math.floor(5 + Math.random() * 15);
money = Math.max(0, money - fine);
moodLevel = Math.max(0, moodLevel - 20);
LK.setTimeout(function () {
officer.destroy();
}, 2000);
updateDisplay();
}
function showEarnings(amount) {
var earningsText = new Text2('+$' + amount, {
size: 30,
fill: 0x00FF00
});
earningsText.anchor.set(0.5, 0.5);
earningsText.x = musician.x;
earningsText.y = musician.y - 150;
game.addChild(earningsText);
tween(earningsText, {
y: earningsText.y - 50,
alpha: 0
}, {
duration: 1500,
onFinish: function onFinish() {
earningsText.destroy();
}
});
}
function nextDay() {
currentDay++;
// Reset time to 12:00 AM for new day
currentHour = 0;
currentMinute = 0;
// Daily resource drain
foodLevel = Math.max(0, foodLevel - 10);
waterLevel = Math.max(0, waterLevel - 10);
// Health effects
if (foodLevel < 20) {
healthLevel = Math.max(0, healthLevel - 15);
moodLevel = Math.max(0, moodLevel - 10);
}
if (waterLevel < 20) {
healthLevel = Math.max(0, healthLevel - 10);
}
if (sleepLevel < 30) {
healthLevel = Math.max(0, healthLevel - 5);
moodLevel = Math.max(0, moodLevel - 15);
}
// Save all game state to storage
storage.currentDay = currentDay;
storage.money = money;
storage.followers = followers;
storage.concerts = concerts;
storage.musicSkill = musicSkill;
storage.equipmentLevel = equipmentLevel;
storage.socialMediaUnlocked = socialMediaUnlocked;
storage.playerLevel = playerLevel;
// Random events
if (Math.random() < 0.2) {
randomEvent();
}
updateDisplay();
checkGameOver();
checkWinConditions();
}
function randomEvent() {
var events = [{
text: "A generous fan gave you $20!",
effect: function effect() {
money += 20;
}
}, {
text: "Rain ruined your guitar strings. -$10",
effect: function effect() {
money = Math.max(0, money - 10);
}
}, {
text: "You met a music producer!",
effect: function effect() {
if (musicSkill >= 70) {
concerts++;
money += 100;
}
}
}];
var event = events[Math.floor(Math.random() * events.length)];
event.effect();
var eventText = new Text2(event.text, {
size: 25,
fill: 0xFFFF00
});
eventText.anchor.set(0.5, 0.5);
eventText.x = 1024;
eventText.y = 1000;
game.addChild(eventText);
tween(eventText, {
alpha: 0
}, {
duration: 3000,
onFinish: function onFinish() {
eventText.destroy();
}
});
}
function updateClock() {
// Update clock hands based on current time
// Hour hand: 30 degrees per hour (360/12) + 0.5 degrees per minute (30/60)
var hourAngle = currentHour % 12 * 30 + currentMinute * 0.5;
// Minute hand: 6 degrees per minute (360/60)
var minuteAngle = currentMinute * 6;
// Convert to radians and rotate (0 degrees = 12 o'clock position)
hourHand.rotation = hourAngle * Math.PI / 180;
minuteHand.rotation = minuteAngle * Math.PI / 180;
// Update time text
var displayHour = currentHour === 0 ? 12 : currentHour > 12 ? currentHour - 12 : currentHour;
var ampm = currentHour < 12 ? 'AM' : 'PM';
var minuteStr = currentMinute < 10 ? '0' + currentMinute : currentMinute;
timeText.setText(displayHour + ':' + minuteStr + ' ' + ampm);
// Update daylight based on time
updateDaylight();
}
function updateDaylight() {
var timeOfDay = currentHour + currentMinute / 60;
var brightness;
// Hide all backgrounds first
morningBackground.visible = false;
noonBackground.visible = false;
eveningBackground.visible = false;
nightBackground.visible = false;
// Only show backgrounds when on street corner screen
if (currentScreen === 'streetCorner') {
if (timeOfDay >= 6 && timeOfDay < 12) {
// Morning (6 AM - 12 PM)
brightness = 0.7 + (timeOfDay - 6) * 0.05; // 0.7 to 1.0
morningBackground.visible = true;
} else if (timeOfDay >= 12 && timeOfDay < 18) {
// Noon/Afternoon (12 PM - 6 PM)
brightness = 1.0;
noonBackground.visible = true;
} else if (timeOfDay >= 18 && timeOfDay < 22) {
// Evening (6 PM - 10 PM)
brightness = 1.0 - (timeOfDay - 18) * 0.15; // 1.0 to 0.4
eveningBackground.visible = true;
} else {
// Night (10 PM - 6 AM)
brightness = 0.4;
nightBackground.visible = true;
}
}
dayLightLevel = brightness;
// Adjust lamp glow based on time
if (lampGlow) {
lampGlow.alpha = brightness < 0.7 ? 0.6 : 0.2;
}
}
function updateDisplay() {
dayText.setText('Day ' + currentDay);
moneyText.setText('$' + money);
followersText.setText('Followers: ' + followers);
foodBar.setValue(foodLevel);
waterBar.setValue(waterLevel);
healthBar.setValue(healthLevel);
moodBar.setValue(moodLevel);
sleepBar.setValue(sleepLevel);
// Update level up button cost
var levelUpCost = 50 + equipmentLevel * 25;
var levelUpButtonText = levelUpButton.children[1];
levelUpButtonText.setText('Level Up ($' + levelUpCost + ')');
// Update clock display
updateClock();
}
function checkGameOver() {
if (healthLevel <= 0) {
gamePhase = 'gameOver';
LK.showGameOver();
} else if (moodLevel <= 0) {
gamePhase = 'gameOver';
LK.showGameOver();
} else if (currentDay > 30) {
if (concerts < 3 || followers < 1000) {
gamePhase = 'gameOver';
LK.showGameOver();
}
}
}
function checkWinConditions() {
if (concerts >= 3 && followers >= 1000 && currentDay <= 30) {
gamePhase = 'won';
LK.showYouWin();
}
}
// Game screens management
var currentScreen = 'streetCorner';
// Separate element arrays for each screen to ensure complete independence
var streetCornerElements = [];
var marketElements = [];
var hotelElements = [];
var studioElements = [];
// Store street corner elements separately
streetCornerElements.push(morningBackground, noonBackground, eveningBackground, nightBackground);
streetCornerElements.push(sittingBench);
streetCornerElements.push(performButton, levelUpButton, nextDayButton);
for (var i = 0; i < musicButtons.length; i++) {
streetCornerElements.push(musicButtons[i]);
}
streetCornerElements.push(foodBar, waterBar, healthBar, moodBar, sleepBar);
streetCornerElements.push(foodLabel, waterLabel, healthLabel, moodLabel, sleepLabel);
streetCornerElements.push(streetLamp, lampGlow);
streetCornerElements.push(musician);
// Create collapsible navigation window
var navWindow = new CollapsibleWindow();
navWindow.x = 2048; // Position at right edge
navWindow.y = 1466; // Center vertically
game.addChild(navWindow);
// Add navigation buttons to collapsible window with proper spacing relative to background
var buttonSpacing = 200;
var startY = -300;
var streetNavButton = navWindow.addNavButton('STREET CORNER', 'streetCorner', 'streetCornerNav', startY);
var marketNavButton = navWindow.addNavButton('MARKET', 'market', 'market', startY + buttonSpacing);
var hotelNavButton = navWindow.addNavButton('HOTEL', 'hotel', 'hotel', startY + buttonSpacing * 2);
var studioNavButton = navWindow.addNavButton('STUDIO', 'studio', 'studioNav', startY + buttonSpacing * 3);
// Market screen elements (already declared above)
var marketTitle = new Text2('MARKET', {
size: 80,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
marketTitle.anchor.set(0.5, 0.5);
marketTitle.x = 1024;
marketTitle.y = 400;
marketElements.push(marketTitle);
// Create market aisle with food and water items
var breadButton = new ActionButton('Bread ($5)', function () {
if (money >= 5) {
money -= 5;
foodLevel = Math.min(100, foodLevel + 30);
storage.money = money;
updateDisplay();
LK.getSound('coinDrop').play();
}
});
breadButton.x = 250;
breadButton.y = 900;
breadButton.scaleX = 1.5;
breadButton.scaleY = 1.5;
marketElements.push(breadButton);
var breadPriceText = new Text2('$5', {
size: 36,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
breadPriceText.anchor.set(0.5, 0);
breadPriceText.x = 250;
breadPriceText.y = 980;
marketElements.push(breadPriceText);
var appleButton = new ActionButton('Apple ($3)', function () {
if (money >= 3) {
money -= 3;
foodLevel = Math.min(100, foodLevel + 20);
storage.money = money;
updateDisplay();
LK.getSound('coinDrop').play();
}
});
appleButton.x = 650;
appleButton.y = 900;
appleButton.scaleX = 1.5;
appleButton.scaleY = 1.5;
marketElements.push(appleButton);
var applePriceText = new Text2('$3', {
size: 36,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
applePriceText.anchor.set(0.5, 0);
applePriceText.x = 650;
applePriceText.y = 980;
marketElements.push(applePriceText);
var waterBottleButton = new ActionButton('Water Bottle ($2)', function () {
if (money >= 2) {
money -= 2;
waterLevel = Math.min(100, waterLevel + 25);
storage.money = money;
updateDisplay();
LK.getSound('coinDrop').play();
}
});
waterBottleButton.x = 1050;
waterBottleButton.y = 900;
waterBottleButton.scaleX = 1.5;
waterBottleButton.scaleY = 1.5;
marketElements.push(waterBottleButton);
var waterPriceText = new Text2('$2', {
size: 36,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
waterPriceText.anchor.set(0.5, 0);
waterPriceText.x = 1050;
waterPriceText.y = 980;
marketElements.push(waterPriceText);
var mealButton = new ActionButton('Full Meal ($10)', function () {
if (money >= 10) {
money -= 10;
foodLevel = Math.min(100, foodLevel + 60);
waterLevel = Math.min(100, waterLevel + 30);
storage.money = money;
updateDisplay();
LK.getSound('coinDrop').play();
}
});
mealButton.x = 1450;
mealButton.y = 900;
mealButton.scaleX = 1.5;
mealButton.scaleY = 1.5;
marketElements.push(mealButton);
var mealPriceText = new Text2('$10', {
size: 36,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
mealPriceText.anchor.set(0.5, 0);
mealPriceText.x = 1450;
mealPriceText.y = 980;
marketElements.push(mealPriceText);
var energyDrinkButton = new ActionButton('Energy Drink ($4)', function () {
if (money >= 4) {
money -= 4;
waterLevel = Math.min(100, waterLevel + 20);
moodLevel = Math.min(100, moodLevel + 10);
storage.money = money;
updateDisplay();
LK.getSound('coinDrop').play();
}
});
energyDrinkButton.x = 1850;
energyDrinkButton.y = 900;
energyDrinkButton.scaleX = 1.5;
energyDrinkButton.scaleY = 1.5;
marketElements.push(energyDrinkButton);
var energyDrinkPriceText = new Text2('$4', {
size: 36,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
energyDrinkPriceText.anchor.set(0.5, 0);
energyDrinkPriceText.x = 1850;
energyDrinkPriceText.y = 980;
marketElements.push(energyDrinkPriceText);
// Add a new box to the market (purely visual)
var marketBox = new Container();
var boxGraphics = marketBox.attachAsset('marketreyon', {
anchorX: 0.5,
anchorY: 1
});
marketBox.x = 1024;
marketBox.y = 2332;
marketElements.push(marketBox);
// Add NPC behind market reyonu
var marketNPC = new NPC();
marketNPC.x = 1024;
marketNPC.y = 2332 - 50 + 50; // Position behind the market reyonu (closer to back) + 50 pixels down
marketElements.push(marketNPC);
// Start the movement animation
marketNPC.startMovement();
// Stop the movement animation
marketNPC.stopMovement();
// Add market aisle labels
var aisleLabel = new Text2('FOOD & DRINK AISLE', {
size: 48,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
aisleLabel.anchor.set(0.5, 0.5);
aisleLabel.x = 1024;
aisleLabel.y = 600;
marketElements.push(aisleLabel);
// Hotel screen elements (already declared above)
var hotelTitle = new Text2('HOTEL', {
size: 80,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
hotelTitle.anchor.set(0.5, 0.5);
hotelTitle.x = 1024;
hotelTitle.y = 400;
hotelElements.push(hotelTitle);
// Studio screen elements (already declared above)
var studioTitle = new Text2('STUDIO', {
size: 80,
fill: 0x000000,
font: "'Arial Black','Arial',sans-serif"
});
studioTitle.anchor.set(0.5, 0.5);
studioTitle.x = 1024;
studioTitle.y = 400;
studioElements.push(studioTitle);
function navigateToLocation(targetLocation) {
// Hide all current screen elements
hideCurrentScreenElements();
// Navigation buttons visibility handled by collapsible window
currentScreen = targetLocation;
if (targetLocation === 'streetCorner') {
// Show street corner elements
for (var i = 0; i < streetCornerElements.length; i++) {
streetCornerElements[i].visible = true;
}
} else if (targetLocation === 'market') {
// Show market elements
for (var i = 0; i < marketElements.length; i++) {
if (!marketElements[i].parent) {
game.addChild(marketElements[i]);
}
marketElements[i].visible = true;
}
} else if (targetLocation === 'hotel') {
// Show hotel elements
for (var i = 0; i < hotelElements.length; i++) {
if (!hotelElements[i].parent) {
game.addChild(hotelElements[i]);
}
hotelElements[i].visible = true;
}
} else if (targetLocation === 'studio') {
// Show studio elements
for (var i = 0; i < studioElements.length; i++) {
if (!studioElements[i].parent) {
game.addChild(studioElements[i]);
}
studioElements[i].visible = true;
}
}
}
function hideCurrentScreenElements() {
// Hide street corner elements
for (var i = 0; i < streetCornerElements.length; i++) {
streetCornerElements[i].visible = false;
}
// Hide market elements
for (var i = 0; i < marketElements.length; i++) {
marketElements[i].visible = false;
}
// Hide hotel elements
for (var i = 0; i < hotelElements.length; i++) {
hotelElements[i].visible = false;
}
// Hide studio elements
for (var i = 0; i < studioElements.length; i++) {
studioElements[i].visible = false;
}
}
// Initialize display
updateDisplay();
game.update = function () {
// Game runs at 60fps, update logic here if needed
resourceDrainTimer++;
// Drain resources every 60 frames (1 second at 60fps)
if (resourceDrainTimer >= 60) {
resourceDrainTimer = 0;
// Randomly select one resource to decrease
var randomResource = Math.floor(Math.random() * 5);
var drainAmount = 1 + Math.random() * 2; // Random amount between 1-3
switch (randomResource) {
case 0:
foodLevel = Math.max(0, foodLevel - drainAmount);
break;
case 1:
waterLevel = Math.max(0, waterLevel - drainAmount);
break;
case 2:
healthLevel = Math.max(0, healthLevel - drainAmount);
break;
case 3:
moodLevel = Math.max(0, moodLevel - drainAmount);
break;
case 4:
sleepLevel = Math.max(0, sleepLevel - drainAmount);
break;
}
// Update the display bars
foodBar.setValue(foodLevel);
waterBar.setValue(waterLevel);
healthBar.setValue(healthLevel);
moodBar.setValue(moodLevel);
sleepBar.setValue(sleepLevel);
// Check for game over conditions due to resource depletion
checkGameOver();
// Update time progression (1 minute every second)
currentMinute += timeSpeed;
if (currentMinute >= 60) {
currentMinute = 0;
currentHour++;
if (currentHour >= 24) {
currentHour = 0;
}
}
// Update clock display
updateClock();
}
}; ===================================================================
--- original.js
+++ change.js
@@ -532,9 +532,9 @@
var playerLevel = storage.playerLevel || 1;
// Clock variables
var currentHour = 0; // Start at 12:00 AM (midnight)
var currentMinute = 0;
-var timeSpeed = 1; // How fast time moves (1 = normal speed)
+var timeSpeed = 1.5; // How fast time moves (1.5 = 1.5x faster than normal speed)
var dayLightLevel = 0.5; // Controls background brightness based on time
// Resources
var foodLevel = 100;
var waterLevel = 100;
pixel yatak. In-Game asset. 2d. High contrast. No shadows
pixel
Market pixel. In-Game asset. 2d. High contrast. No shadows
hotel pixel. In-Game asset. 2d. High contrast. No shadows
sokak lambası kaldırım ve bank pixel. In-Game asset. 2d. High contrast. No shadows
Music studio pixel. In-Game asset. 2d. High contrast. No shadows
water pixel. In-Game asset. 2d. High contrast. No shadows
Navigation pixel. In-Game asset. 2d. High contrast. No shadows
pixel phone frame. In-Game asset. 2d. High contrast. No shadows
street lamp pixel. In-Game asset. 2d. High contrast. No shadows
make pixels
sitting bench pixels. In-Game asset. 2d. High contrast. No shadows
clock face. no clock hour stick and minute stick only the clock face In-Game asset. 2d. High contrast. No shadows
DİRTY AND BROKE guitar pixel. dik dursun In-Game asset. 2d. High contrast. No shadows
same picture but night
same picture but morning
same picture noon time pixel
police officer pixel. detaylı surat full body In-Game asset. 2d. High contrast. No shadows
same picture but evening