User prompt
Make palestine flag 0$
User prompt
After 20 seconds in pink slip the game restarts āŖš” Consider importing and using the following plugins: @upit/tween.v1
User prompt
When player is in the pink slip remove the main game song and add pink slip background sound
User prompt
Make itās position higher and slightly left
User prompt
Put it on the center of the pink slip
User prompt
Put a image to the center of the pink slip
User prompt
Add the ensure corporate image to the center of pink slip
User prompt
I cant see the image
User prompt
Make an image asset for that
User prompt
Add a big image to the center of the pink slip
User prompt
Add background image asset for pink slip
User prompt
Still doesnt cover whole of my screen make it bigger
User prompt
It still doesnt cover my whole screen
User prompt
Make it cover all of my screen
User prompt
Make it cover all of my screen
User prompt
Oyuncu āPink slipā yerine geldigĢinde, ana oyundan farklı bir yere gitsin, ana oyun goĢzuĢkmesin
User prompt
āPink slipā yeri oyundan bagĢımsız bir yerq
User prompt
Make pink slip location different from the main game location
User prompt
Take player to a new place called āPink slipā when player buys Palestine Flag
User prompt
Remove Palestine Flag Cutscene
User prompt
Make everything invisible even customers when Palestine flag cutscene is playing
User prompt
Remove āAdd more tablesā button
User prompt
Make sound system shaped right rectange
User prompt
Make soud system shaped horizontally Rectangle
User prompt
Make Basketball Machine bigger, Make Money pool bigger, make Mango Juice Machine bigger, make kitchen table shaped Rectangle, make sound system shaped Rectangle and bigger
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Chef = Container.expand(function () {
var self = Container.call(this);
var chefGraphics = self.attachAsset('chef', {
anchorX: 0.5,
anchorY: 0.5
});
self.efficiencyBonus = 2;
return self;
});
var Customer = Container.expand(function () {
var self = Container.call(this);
var customerGraphics = self.attachAsset('customer', {
anchorX: 0.5,
anchorY: 0.5
});
self.satisfaction = 1;
self.timeInRestaurant = 0;
self.maxTime = 300; // 5 seconds at 60fps
self.hasEaten = false;
self.currentTable = null;
self.update = function () {
self.timeInRestaurant++;
// Try to sit at a table if not already seated
if (!self.currentTable && self.timeInRestaurant > 30) {
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
if (!table.occupied) {
self.currentTable = table;
table.occupied = true;
// Add food to table immediately when customer sits
if (!table.food) {
table.food = table.addChild(LK.getAsset('food', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -30
}));
// Make food appear with a small scale animation
table.food.scaleX = 0;
table.food.scaleY = 0;
tween(table.food, {
scaleX: 1,
scaleY: 1
}, {
duration: 500
});
}
// Move customer to table with tween animation
tween(self, {
x: table.x,
y: table.y + 100
}, {
duration: 1000
});
break;
}
}
}
if (!self.hasEaten && self.timeInRestaurant > 60 && self.currentTable) {
// Customer eats and pays (only when seated)
var payment = Math.floor(10 * (restaurantQuality || 1) * (self.satisfaction || 1));
// Ensure payment is a valid number
if (isNaN(payment) || payment < 0) {
payment = 10;
}
// Check if this is a fancy customer (has gold tint) and reduce payment
if (self.tint === 0xFFD700) {
payment = Math.floor(payment * 0.6); // Fancy customers pay 60% of normal amount
}
money = (money || 0) + payment;
// Ensure money is always a valid number
if (isNaN(money)) {
money = 50; // Reset to starting amount if NaN
}
moneyTxt.setText('$' + money);
self.hasEaten = true;
// Customer satisfaction affects tip
if (Math.random() < (restaurantQuality || 1) / 10) {
var tip = Math.floor(payment * 0.5);
// Ensure tip is valid
if (isNaN(tip) || tip < 0) {
tip = 0;
}
// Reduce tip for fancy customers too
if (self.tint === 0xFFD700) {
tip = Math.floor(tip * 0.6);
}
money = (money || 0) + tip;
// Ensure money is always a valid number
if (isNaN(money)) {
money = 50; // Reset to starting amount if NaN
}
moneyTxt.setText('$' + money);
}
}
if (self.timeInRestaurant > self.maxTime && !self.isLeaving) {
// Mark customer as leaving to prevent multiple leave animations
self.isLeaving = true;
// Customer leaves and frees up table
if (self.currentTable) {
self.currentTable.occupied = false;
// Remove food from table
if (self.currentTable.food) {
self.currentTable.food.destroy();
self.currentTable.food = null;
}
}
// Animate customer leaving the restaurant
tween(self, {
x: -200,
// Move off screen to the left
alpha: 0.5 // Fade out slightly
}, {
duration: 1500,
onFinish: function onFinish() {
// Remove from customers array and destroy after animation
for (var i = customers.length - 1; i >= 0; i--) {
if (customers[i] === self) {
customers.splice(i, 1);
break;
}
}
self.destroy();
}
});
}
};
return self;
});
var Decoration = Container.expand(function () {
var self = Container.call(this);
var decorationGraphics = self.attachAsset('decoration', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 1;
return self;
});
var GameMachine = Container.expand(function () {
var self = Container.call(this);
var machineGraphics = self.attachAsset('gameMachine', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 3;
return self;
});
var Kid67Customer = Container.expand(function () {
var self = Container.call(this);
var customerGraphics = self.attachAsset('67kid', {
anchorX: 0.5,
anchorY: 0.5
});
self.satisfaction = 0.67; // 67% of normal satisfaction
self.timeInRestaurant = 0;
self.maxTime = 450; // Kids stay longer
self.hasEaten = false;
self.currentTable = null;
self.watchingStage = false;
self.stageWatchTime = 0;
self.update = function () {
self.timeInRestaurant++;
// Check if there's a stage to watch and customer hasn't sat at table yet
if (!self.currentTable && !self.watchingStage && stages.length > 0 && self.timeInRestaurant > 60) {
var stage = stages[0];
var distanceToStage = Math.sqrt((self.x - stage.x) * (self.x - stage.x) + (self.y - stage.y) * (self.y - stage.y));
// 40% chance to go watch the stage instead of sitting at table
if (Math.random() < 0.4) {
self.watchingStage = true;
// Move to watch stage
tween(self, {
x: stage.x + (Math.random() - 0.5) * 300,
y: stage.y + 150
}, {
duration: 1500
});
}
}
// If watching stage, stay for a while before leaving or finding table
if (self.watchingStage) {
self.stageWatchTime++;
// Watch stage for 3-5 seconds before deciding to leave or find table
if (self.stageWatchTime > 180 + Math.random() * 120) {
self.watchingStage = false;
// 60% chance to find table after watching, 40% chance to leave
if (Math.random() < 0.6 && !self.currentTable) {
// Try to find a table after watching stage
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
if (!table.occupied) {
self.currentTable = table;
table.occupied = true;
// Add food to table
if (!table.food) {
table.food = table.addChild(LK.getAsset('food', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -30
}));
table.food.scaleX = 0;
table.food.scaleY = 0;
tween(table.food, {
scaleX: 1,
scaleY: 1
}, {
duration: 500
});
}
// Move to table
tween(self, {
x: table.x,
y: table.y + 100
}, {
duration: 1000
});
break;
}
}
}
}
}
// Try to sit at a table if not watching stage and not already seated
if (!self.currentTable && !self.watchingStage && self.timeInRestaurant > 30) {
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
if (!table.occupied) {
self.currentTable = table;
table.occupied = true;
// Add food to table immediately when customer sits
if (!table.food) {
table.food = table.addChild(LK.getAsset('food', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -30
}));
table.food.scaleX = 0;
table.food.scaleY = 0;
tween(table.food, {
scaleX: 1,
scaleY: 1
}, {
duration: 500
});
}
// Move customer to table
tween(self, {
x: table.x,
y: table.y + 100
}, {
duration: 1000
});
break;
}
}
}
if (!self.hasEaten && self.timeInRestaurant > 60 && self.currentTable) {
// Customer eats and pays (67% of normal payment)
var payment = Math.floor(10 * (restaurantQuality || 1) * (self.satisfaction || 1));
if (isNaN(payment) || payment < 0) {
payment = 6; // 67% of base 10
}
money = (money || 0) + payment;
if (isNaN(money)) {
money = 50;
}
moneyTxt.setText('$' + money);
self.hasEaten = true;
// Reduced tip chance for kid customers
if (Math.random() < (restaurantQuality || 1) / 15) {
var tip = Math.floor(payment * 0.3);
if (isNaN(tip) || tip < 0) {
tip = 0;
}
money = (money || 0) + tip;
if (isNaN(money)) {
money = 50;
}
moneyTxt.setText('$' + money);
}
}
if (self.timeInRestaurant > self.maxTime && !self.isLeaving) {
self.isLeaving = true;
// Free up table
if (self.currentTable) {
self.currentTable.occupied = false;
if (self.currentTable.food) {
self.currentTable.food.destroy();
self.currentTable.food = null;
}
}
// Leave restaurant
tween(self, {
x: -200,
alpha: 0.5
}, {
duration: 1500,
onFinish: function onFinish() {
for (var i = customers.length - 1; i >= 0; i--) {
if (customers[i] === self) {
customers.splice(i, 1);
break;
}
}
self.destroy();
}
});
}
};
return self;
});
var KitchenUpgrade = Container.expand(function () {
var self = Container.call(this);
var kitchenGraphics = self.attachAsset('kitchenUpgrade', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 3;
return self;
});
var LightingKit = Container.expand(function () {
var self = Container.call(this);
var lightingGraphics = self.attachAsset('lightingKit', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 2;
return self;
});
var SoundSystem = Container.expand(function () {
var self = Container.call(this);
var soundGraphics = self.attachAsset('soundSystem', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 2.5;
return self;
});
var Stage = Container.expand(function () {
var self = Container.call(this);
var stageGraphics = self.attachAsset('stage', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 3;
return self;
});
var Table = Container.expand(function (type) {
var self = Container.call(this);
var tableGraphics = self.attachAsset(type || 'table', {
anchorX: 0.5,
anchorY: 0.5
});
self.occupied = false;
self.qualityBonus = type === 'fancyTable' ? 2 : 1;
self.food = null;
return self;
});
var Tables = Container.expand(function () {
var self = Container.call(this);
var tableGraphics = self.attachAsset('table', {
anchorX: 0.5,
anchorY: 0.5
});
self.occupied = false;
self.qualityBonus = 1;
self.food = null;
self.tableType = 'regular';
return self;
});
var VipSection = Container.expand(function () {
var self = Container.call(this);
var vipGraphics = self.attachAsset('vipSection', {
anchorX: 0.5,
anchorY: 0.5
});
self.qualityBonus = 4;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x90EE90
});
/****
* Game Code
****/
var money = 50;
var restaurantQuality = 1;
var customers = [];
var tables = [];
var gameMachines = [];
var decorations = [];
var soundSystems = [];
var lightingKits = [];
var vipSections = [];
var kitchenUpgrades = [];
var chefs = [];
var stages = [];
var stagePurchased = false;
var animatronicsShopUnlocked = false;
var shopOpen = false;
var animatronicsShopOpen = false;
var animatronicsShopPanel = null;
var animatronicsShopButtons = [];
var lastCustomerSpawn = 0;
var upgrade1Purchased = false;
var upgrade2Purchased = false;
var tablesPurchased = 0;
var soundPurchased = false;
var vipPurchased = false;
var kitchenPurchased = false;
var mangoJuicePurchased = false;
var familyDiningPurchased = false;
var moneyPoolPurchased = false;
var currentShopPage = 1;
var baseCustomerSpawn = 2;
var fancyCustomerSpawn = 0;
var basketballPurchased = false;
var palestineFlagPurchased = false;
// Create restaurant background
var restaurant = game.addChild(LK.getAsset('restaurant', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366
}));
// Create restaurant walls for outline with precise positioning
// Restaurant is 1800x1200 at position (1024, 1366)
var restaurantCenterX = 1024;
var restaurantCenterY = 1366;
var restaurantWidth = 1800;
var restaurantHeight = 1200;
var wallThickness = 100;
// Left wall - positioned at left edge of restaurant
var leftWall = game.addChild(LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
x: restaurantCenterX - restaurantWidth / 2 - wallThickness / 2,
y: restaurantCenterY,
width: wallThickness,
height: restaurantHeight + wallThickness
}));
// Right wall - positioned at right edge of restaurant
var rightWall = game.addChild(LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
x: restaurantCenterX + restaurantWidth / 2 + wallThickness / 2,
y: restaurantCenterY,
width: wallThickness,
height: restaurantHeight + wallThickness
}));
// Top wall - positioned at top edge of restaurant
var topWall = game.addChild(LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
x: restaurantCenterX,
y: restaurantCenterY - restaurantHeight / 2 - wallThickness / 2,
width: restaurantWidth + wallThickness * 2,
height: wallThickness
}));
// Bottom wall - positioned at bottom edge of restaurant
var bottomWall = game.addChild(LK.getAsset('wall', {
anchorX: 0.5,
anchorY: 0.5,
x: restaurantCenterX,
y: restaurantCenterY + restaurantHeight / 2 + wallThickness / 2,
width: restaurantWidth + wallThickness * 2,
height: wallThickness
}));
// Create initial tables with better spacing
var table1 = new Table();
table1.x = 600;
table1.y = 1100;
game.addChild(table1);
tables.push(table1);
var table2 = new Table();
table2.x = 1400;
table2.y = 1100;
game.addChild(table2);
tables.push(table2);
// Money display
var moneyTxt = new Text2('$' + money, {
size: 60,
fill: 0x000000
});
moneyTxt.anchor.set(0, 0);
moneyTxt.x = 150;
moneyTxt.y = 50;
LK.gui.topLeft.addChild(moneyTxt);
// Upgrade 1 button on top of restaurant
var upgrade1Btn = game.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 700
}));
var upgrade1BtnTxt = new Text2('UPGRADE 1 - $300', {
size: 30,
fill: 0xFFFFFF
});
upgrade1BtnTxt.anchor.set(0.5, 0.5);
upgrade1Btn.addChild(upgrade1BtnTxt);
upgrade1Btn.down = function (x, y, obj) {
if (money >= 300) {
money -= 300;
moneyTxt.setText('$' + money);
// Make restaurant bigger
tween(restaurant, {
scaleX: 1.5,
scaleY: 1.5
}, {
duration: 1000
});
// Calculate precise wall positions for 1.5x scaled restaurant
var scale = 1.5;
var scaledWidth = restaurantWidth * scale;
var scaledHeight = restaurantHeight * scale;
var centerX = restaurantCenterX;
var centerY = restaurantCenterY;
// Calculate new wall positions with proper scaling
var leftWallX = centerX - scaledWidth / 2 - wallThickness / 2;
var rightWallX = centerX + scaledWidth / 2 + wallThickness / 2;
var topWallY = centerY - scaledHeight / 2 - wallThickness / 2;
var bottomWallY = centerY + scaledHeight / 2 + wallThickness / 2;
// Animate walls to new positions and sizes
tween(leftWall, {
x: leftWallX,
scaleY: scale
}, {
duration: 1000
});
tween(rightWall, {
x: rightWallX,
scaleY: scale
}, {
duration: 1000
});
tween(topWall, {
y: topWallY,
scaleX: scale
}, {
duration: 1000
});
tween(bottomWall, {
y: bottomWallY,
scaleX: scale
}, {
duration: 1000,
onFinish: function onFinish() {
// Remove the upgrade button after animation completes
upgrade1Btn.destroy();
}
});
upgrade1Purchased = true;
console.log("Restaurant upgraded!");
// Create upgrade 2 button after upgrade 1 is purchased
var upgrade2Btn = game.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 700
}));
var upgrade2BtnTxt = new Text2('UPGRADE 2 - $250000', {
size: 30,
fill: 0xFFFFFF
});
upgrade2BtnTxt.anchor.set(0.5, 0.5);
upgrade2Btn.addChild(upgrade2BtnTxt);
upgrade2Btn.down = function (x, y, obj) {
if (money >= 250000) {
money -= 250000;
moneyTxt.setText('$' + money);
// Make restaurant even bigger (2x scale total)
tween(restaurant, {
scaleX: 2,
scaleY: 2
}, {
duration: 1000
});
// Zoom out the camera by scaling the entire game
tween(game, {
scaleX: 0.7,
scaleY: 0.7
}, {
duration: 1000
});
// Keep admin button and shop button in stable screen positions
// Scale them inversely to maintain their apparent size and adjust positions
tween(adminBtn, {
scaleX: 1.43,
// 1/0.7 to counteract game zoom
scaleY: 1.43,
x: 1900 / 0.7,
// Adjust position for zoom
y: 2600 / 0.7
}, {
duration: 1000
});
tween(shopBtn, {
scaleX: 1.43,
// 1/0.7 to counteract game zoom
scaleY: 1.43,
x: 1900 / 0.7,
// Adjust position for zoom
y: 150 / 0.7
}, {
duration: 1000
});
// Scale shop panel to maintain proper visibility and position
if (shopPanel && shopPanel.parent) {
tween(shopPanel, {
scaleX: 1.43,
scaleY: 1.43,
x: 1024 / 0.7,
y: 1366 / 0.7
}, {
duration: 1000
});
}
// Update wall positions for 2x scaled restaurant
var scale = 2;
var scaledWidth = restaurantWidth * scale;
var scaledHeight = restaurantHeight * scale;
var centerX = restaurantCenterX;
var centerY = restaurantCenterY;
// Calculate new wall positions for 2x scale
var leftWallX = centerX - scaledWidth / 2 - wallThickness / 2;
var rightWallX = centerX + scaledWidth / 2 + wallThickness / 2;
var topWallY = centerY - scaledHeight / 2 - wallThickness / 2;
var bottomWallY = centerY + scaledHeight / 2 + wallThickness / 2;
// Animate walls to new positions and sizes
tween(leftWall, {
x: leftWallX,
scaleY: scale
}, {
duration: 1000
});
tween(rightWall, {
x: rightWallX,
scaleY: scale
}, {
duration: 1000
});
tween(topWall, {
y: topWallY,
scaleX: scale
}, {
duration: 1000
});
tween(bottomWall, {
y: bottomWallY,
scaleX: scale
}, {
duration: 1000,
onFinish: function onFinish() {
// Remove the upgrade 2 button after animation completes
upgrade2Btn.destroy();
}
});
upgrade2Purchased = true;
console.log("Restaurant upgraded to level 2!");
} else {
console.log("Not enough money - need $250000");
}
};
} else {
console.log("Not enough money - need $300");
}
};
// Shop button
var shopBtn = game.addChild(LK.getAsset('shopButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1900,
y: 150
}));
var shopBtnTxt = new Text2('SHOP', {
size: 40,
fill: 0xFFFFFF
});
shopBtnTxt.anchor.set(0.5, 0.5);
shopBtn.addChild(shopBtnTxt);
shopBtn.down = function (x, y, obj) {
if (!shopOpen) {
openShop();
}
};
// Shop panel (initially hidden) - full screen coverage
var shopPanel = game.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
width: 2048,
height: 2732
}));
shopPanel.visible = false;
// Create animatronics shop panel (initially hidden)
var animatronicsShopPanel = game.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
width: 2048,
height: 2732,
color: 0x2F1B69
}));
animatronicsShopPanel.visible = false;
// Shop items - Page 1
var shopItems = [{
name: 'Extra Tables',
price: 150,
type: 'tables'
}, {
name: 'Sound System',
price: 250,
type: 'sound'
}, {
name: 'VIP Section',
price: 400,
type: 'vip'
}, {
name: 'Kitchen Upgrade',
price: 300,
type: 'kitchen'
}];
// Shop items - Page 2
var shopItems2 = [{
name: 'Basketball Machine',
price: 100000,
type: 'basketball'
}, {
name: 'Stage',
price: 200000,
type: 'stage'
}];
// Shop items - Page 3
var shopItems3 = [{
name: 'Palestine Flag',
price: 5000000,
type: 'palestineFlag'
}];
var shopButtons = [];
function createShopButtons() {
// Determine which items to show based on current page
var currentShopItems;
if (currentShopPage === 1) {
currentShopItems = shopItems.slice(); // Copy the base shop items
} else if (currentShopPage === 2) {
currentShopItems = shopItems2.slice(); // Page 2 items
// Add Mango Juice Machine to page 2 after upgrade 2 is purchased
if (upgrade2Purchased) {
currentShopItems.push({
name: 'Mango Juice Machine',
price: 450000,
type: 'mangoJuice'
});
currentShopItems.push({
name: 'Family Dining Area',
price: 800000,
type: 'familyDining'
});
currentShopItems.push({
name: 'Money Pool',
price: 2000000,
type: 'moneyPool'
});
}
} else {
currentShopItems = shopItems3.slice(); // Page 3 items
}
for (var i = 0; i < currentShopItems.length; i++) {
var item = currentShopItems[i];
var btn = shopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -300 + i * 150
}));
var btnTxt = new Text2(item.name + ' - $' + item.price, {
size: 30,
fill: 0xFFFFFF
});
btnTxt.anchor.set(0.5, 0.5);
btn.addChild(btnTxt);
btn.itemType = item.type;
btn.itemPrice = item.price;
btn.itemName = item.name;
// Use closure to capture the correct item values
// Check if item is already purchased and disable button
var isAlreadyPurchased = false;
if (item.type === 'sound' && soundPurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'vip' && vipPurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'kitchen' && kitchenPurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'tables' && tablesPurchased >= 8) {
isAlreadyPurchased = true;
} else if (item.type === 'basketball' && basketballPurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'stage' && stagePurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'mangoJuice' && mangoJuicePurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'familyDining' && familyDiningPurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'moneyPool' && moneyPoolPurchased) {
isAlreadyPurchased = true;
} else if (item.type === 'palestineFlag' && palestineFlagPurchased) {
isAlreadyPurchased = true;
}
if (isAlreadyPurchased) {
btnTxt.text = 'PURCHASED';
btn.alpha = 0.5;
btn.down = null;
} else {
btn.down = function (itemType, itemPrice) {
return function (x, y, obj) {
purchaseItem(itemType, itemPrice);
};
}(item.type, item.price);
}
shopButtons.push(btn);
}
// Navigation buttons
if (currentShopPage === 1) {
// Next page button - only show if upgrade 1 is purchased
if (upgrade1Purchased) {
var nextPageBtn = shopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 600,
color: 0x4169E1
}));
var nextPageTxt = new Text2('NEXT PAGE', {
size: 30,
fill: 0xFFFFFF
});
nextPageTxt.anchor.set(0.5, 0.5);
nextPageBtn.addChild(nextPageTxt);
nextPageBtn.down = function (x, y, obj) {
currentShopPage = 2;
// Clear existing shop buttons
for (var i = 0; i < shopButtons.length; i++) {
shopButtons[i].destroy();
}
shopButtons = [];
// Recreate shop buttons for page 2
createShopButtons();
};
shopButtons.push(nextPageBtn);
}
} else if (currentShopPage === 2) {
// Previous page button
var prevPageBtn = shopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: 600,
color: 0x4169E1
}));
var prevPageTxt = new Text2('PREV PAGE', {
size: 30,
fill: 0xFFFFFF
});
prevPageTxt.anchor.set(0.5, 0.5);
prevPageBtn.addChild(prevPageTxt);
prevPageBtn.down = function (x, y, obj) {
currentShopPage = 1;
// Clear existing shop buttons
for (var i = 0; i < shopButtons.length; i++) {
shopButtons[i].destroy();
}
shopButtons = [];
// Recreate shop buttons for page 1
createShopButtons();
};
shopButtons.push(prevPageBtn);
// Next page button - only show if money pool is purchased
if (moneyPoolPurchased) {
var nextPageBtn = shopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 200,
y: 600,
color: 0x4169E1
}));
var nextPageTxt = new Text2('NEXT PAGE', {
size: 30,
fill: 0xFFFFFF
});
nextPageTxt.anchor.set(0.5, 0.5);
nextPageBtn.addChild(nextPageTxt);
nextPageBtn.down = function (x, y, obj) {
currentShopPage = 3;
// Clear existing shop buttons
for (var i = 0; i < shopButtons.length; i++) {
shopButtons[i].destroy();
}
shopButtons = [];
// Recreate shop buttons for page 3
createShopButtons();
};
shopButtons.push(nextPageBtn);
}
} else {
// Previous page button for page 3
var prevPageBtn = shopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -200,
y: 600,
color: 0x4169E1
}));
var prevPageTxt = new Text2('PREV PAGE', {
size: 30,
fill: 0xFFFFFF
});
prevPageTxt.anchor.set(0.5, 0.5);
prevPageBtn.addChild(prevPageTxt);
prevPageBtn.down = function (x, y, obj) {
currentShopPage = 2;
// Clear existing shop buttons
for (var i = 0; i < shopButtons.length; i++) {
shopButtons[i].destroy();
}
shopButtons = [];
// Recreate shop buttons for page 2
createShopButtons();
};
shopButtons.push(prevPageBtn);
}
// Close shop button
var closeBtn = shopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 700,
color: 0xFF6B6B
}));
var closeTxt = new Text2('CLOSE', {
size: 40,
fill: 0xFFFFFF
});
closeTxt.anchor.set(0.5, 0.5);
closeBtn.addChild(closeTxt);
closeBtn.down = function (x, y, obj) {
closeShop();
};
shopButtons.push(closeBtn);
}
function openShop() {
// Clear existing shop buttons
for (var i = 0; i < shopButtons.length; i++) {
shopButtons[i].destroy();
}
shopButtons = [];
// Recreate shop buttons with current upgrade status
createShopButtons();
shopOpen = true;
shopPanel.visible = true;
// Hide all game elements
restaurant.visible = false;
leftWall.visible = false;
rightWall.visible = false;
topWall.visible = false;
bottomWall.visible = false;
shopBtn.visible = false;
for (var i = 0; i < tables.length; i++) {
tables[i].visible = false;
}
for (var i = 0; i < customers.length; i++) {
customers[i].visible = false;
}
for (var i = 0; i < gameMachines.length; i++) {
gameMachines[i].visible = false;
}
for (var i = 0; i < decorations.length; i++) {
decorations[i].visible = false;
}
for (var i = 0; i < soundSystems.length; i++) {
soundSystems[i].visible = false;
}
for (var i = 0; i < lightingKits.length; i++) {
lightingKits[i].visible = false;
}
for (var i = 0; i < vipSections.length; i++) {
vipSections[i].visible = false;
}
for (var i = 0; i < kitchenUpgrades.length; i++) {
kitchenUpgrades[i].visible = false;
}
for (var i = 0; i < chefs.length; i++) {
chefs[i].visible = false;
}
for (var i = 0; i < stages.length; i++) {
stages[i].visible = false;
}
if (upgrade1Btn && upgrade1Btn.parent) {
upgrade1Btn.visible = false;
}
tween(shopPanel, {
alpha: 1
}, {
duration: 300
});
}
function closeShop() {
shopOpen = false;
tween(shopPanel, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
shopPanel.visible = false;
// Show all game elements when shop closes
restaurant.visible = true;
leftWall.visible = true;
rightWall.visible = true;
topWall.visible = true;
bottomWall.visible = true;
shopBtn.visible = true;
for (var i = 0; i < tables.length; i++) {
tables[i].visible = true;
}
for (var i = 0; i < customers.length; i++) {
customers[i].visible = true;
}
for (var i = 0; i < gameMachines.length; i++) {
gameMachines[i].visible = true;
}
for (var i = 0; i < decorations.length; i++) {
decorations[i].visible = true;
}
for (var i = 0; i < soundSystems.length; i++) {
soundSystems[i].visible = true;
}
for (var i = 0; i < lightingKits.length; i++) {
lightingKits[i].visible = true;
}
for (var i = 0; i < vipSections.length; i++) {
vipSections[i].visible = true;
}
for (var i = 0; i < kitchenUpgrades.length; i++) {
kitchenUpgrades[i].visible = true;
}
for (var i = 0; i < chefs.length; i++) {
chefs[i].visible = true;
}
for (var i = 0; i < stages.length; i++) {
stages[i].visible = true;
}
if (upgrade1Btn && upgrade1Btn.parent) {
upgrade1Btn.visible = true;
}
}
});
}
function purchaseItem(type, price) {
// Check if item is already purchased (except for lighting, money, and tables)
if (type === 'sound' && soundPurchased) {
console.log("Sound system already purchased!");
return;
}
if (type === 'vip' && vipPurchased) {
console.log("VIP section already purchased!");
return;
}
if (type === 'kitchen' && kitchenPurchased) {
console.log("Kitchen upgrade already purchased!");
return;
}
if (type === 'basketball' && basketballPurchased) {
console.log("Basketball machine already purchased!");
return;
}
if (type === 'stage' && stagePurchased) {
console.log("Stage already purchased!");
return;
}
if (type === 'mangoJuice' && mangoJuicePurchased) {
console.log("Mango Juice Machine already purchased!");
return;
}
if (type === 'familyDining' && familyDiningPurchased) {
console.log("Family Dining Area already purchased!");
return;
}
if (type === 'moneyPool' && moneyPoolPurchased) {
console.log("Money Pool already purchased!");
return;
}
if (type === 'palestineFlag' && palestineFlagPurchased) {
console.log("Palestine Flag already purchased!");
return;
}
if (money >= price) {
money = (money || 0) - price;
// Ensure money doesn't become NaN
if (isNaN(money)) {
money = 0;
}
moneyTxt.setText('$' + money);
LK.getSound('purchase').play();
if (type === 'sound') {
var newSoundSystem = new SoundSystem();
newSoundSystem.x = 300 + soundSystems.length * 200;
newSoundSystem.y = 850;
game.addChild(newSoundSystem);
soundSystems.push(newSoundSystem);
restaurantQuality += 1.2;
soundPurchased = true;
baseCustomerSpawn += 1;
} else if (type === 'lighting') {
var newLighting = new LightingKit();
newLighting.x = 600 + lightingKits.length * 300;
newLighting.y = 950;
game.addChild(newLighting);
lightingKits.push(newLighting);
restaurantQuality += 1;
// Add lighting effect
LK.effects.flashObject(newLighting, 0xFFFF00, 2000);
} else if (type === 'vip') {
var newVip = new VipSection();
newVip.x = 1600;
newVip.y = 1600;
game.addChild(newVip);
vipSections.push(newVip);
restaurantQuality += 2;
vipPurchased = true;
fancyCustomerSpawn += 2;
} else if (type === 'kitchen') {
var newKitchen = new KitchenUpgrade();
newKitchen.x = 1024;
newKitchen.y = 1000;
game.addChild(newKitchen);
kitchenUpgrades.push(newKitchen);
restaurantQuality += 1.5;
// Add chef automatically with kitchen upgrade
var newChef = new Chef();
newChef.x = 1024 + chefs.length * 150;
newChef.y = 1100;
game.addChild(newChef);
chefs.push(newChef);
restaurantQuality += 1.0;
kitchenPurchased = true;
baseCustomerSpawn += 1;
} else if (type === 'tables') {
if (tablesPurchased < 8) {
// Create new table using Tables class
var newTable = new Tables();
// Position tables in a grid pattern
var tableRow = Math.floor((tables.length - 2) / 3);
var tableCol = (tables.length - 2) % 3;
newTable.x = 500 + tableCol * 300;
newTable.y = 1200 + tableRow * 200;
game.addChild(newTable);
tables.push(newTable);
restaurantQuality += 0.5;
tablesPurchased++;
baseCustomerSpawn += 1;
console.log("New table added! Total tables: " + tables.length);
}
} else if (type === 'basketball') {
var basketballMachine = game.addChild(LK.getAsset('basketballMachine', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: 2000,
scaleX: 2.0,
scaleY: 2.0
}));
basketballMachine.lastPlayerTime = 0;
basketballMachine.playersNearby = [];
basketballMachine.tint = 0xFFFFFF; // Initialize white tint for flash effects
restaurantQuality += 1.5;
basketballPurchased = true;
// Store reference for later use
basketballMachine.customersBonus = 2;
gameMachines.push(basketballMachine);
} else if (type === 'stage') {
var newStage = new Stage();
newStage.x = 1024;
newStage.y = 650;
game.addChild(newStage);
stages.push(newStage);
restaurantQuality += 2;
stagePurchased = true;
// Stage bonuses: +3 customers, +1 rich customer, +1 67kid customer
baseCustomerSpawn += 3;
fancyCustomerSpawn += 1;
// Add special 67kid customer type spawn bonus
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 1;
// Unlock animatronics shop
animatronicsShopUnlocked = true;
// Create animatronics shop button next to regular shop button
var animatronicsBtn = game.addChild(LK.getAsset('shopButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1900,
y: 250,
color: 0x8A2BE2
}));
var animatronicsBtnTxt = new Text2('ANIMATRONICS', {
size: 30,
fill: 0xFFFFFF
});
animatronicsBtnTxt.anchor.set(0.5, 0.5);
animatronicsBtn.addChild(animatronicsBtnTxt);
// Check if game is zoomed and adjust button accordingly
if (game.scaleX && game.scaleX <= 0.7) {
animatronicsBtn.scaleX = 1.43;
animatronicsBtn.scaleY = 1.43;
animatronicsBtn.x = 1900 / 0.7;
animatronicsBtn.y = 250 / 0.7;
}
animatronicsBtn.down = function (x, y, obj) {
if (!animatronicsShopOpen) {
openAnimatronicsShop();
}
};
} else if (type === 'mangoJuice') {
var mangoJuiceMachine = game.addChild(LK.getAsset('mangoJuiceMachine', {
anchorX: 0.5,
anchorY: 0.5,
x: 1750,
y: 1900,
scaleX: 2.0,
scaleY: 2.0
}));
mangoJuiceMachine.qualityBonus = 2.5;
mangoJuiceMachine.customersBonus = 5;
mangoJuiceMachine.lastPlayerTime = 0;
mangoJuiceMachine.tint = 0xFFFFFF;
restaurantQuality += 2.5;
mangoJuicePurchased = true;
baseCustomerSpawn += 5;
fancyCustomerSpawn += 5;
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 3;
gameMachines.push(mangoJuiceMachine);
} else if (type === 'familyDining') {
var familyDiningArea = game.addChild(LK.getAsset('familyDiningArea', {
anchorX: 0.5,
anchorY: 0.5,
x: 600,
y: 1950,
scaleX: 1.0,
scaleY: 1.0
}));
familyDiningArea.qualityBonus = 3;
restaurantQuality += 3;
familyDiningPurchased = true;
baseCustomerSpawn += 10;
fancyCustomerSpawn += 1;
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 2;
// Add 3 family tables around the dining area
for (var familyTableIndex = 0; familyTableIndex < 3; familyTableIndex++) {
var familyTable = new Table('fancyTable');
familyTable.x = 500 + familyTableIndex * 180;
familyTable.y = 1800;
game.addChild(familyTable);
tables.push(familyTable);
}
} else if (type === 'moneyPool') {
var moneyPool = game.addChild(LK.getAsset('moneyPool', {
anchorX: 0.5,
anchorY: 0.5,
x: 1400,
y: 1950,
scaleX: 2.0,
scaleY: 2.0
}));
moneyPool.qualityBonus = 5;
restaurantQuality += 5;
moneyPoolPurchased = true;
baseCustomerSpawn += 45;
fancyCustomerSpawn += 30;
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 20;
} else if (type === 'palestineFlag') {
palestineFlagPurchased = true;
// Take player to Pink Slip location
goToPinkSlip();
}
// Update button text to show "PURCHASED" for all items except lighting and tables (which can be bought multiple times)
if (type !== 'lighting' && type !== 'tables') {
for (var i = 0; i < shopButtons.length; i++) {
var btn = shopButtons[i];
if (btn.itemType === type) {
var btnText = btn.children[0]; // Get the text child
btnText.text = 'PURCHASED';
btn.alpha = 0.5; // Make button look disabled
btn.down = null; // Remove click handler
break;
}
}
} else if (type === 'tables' && tablesPurchased >= 8) {
// Handle tables purchase limit
for (var i = 0; i < shopButtons.length; i++) {
var btn = shopButtons[i];
if (btn.itemType === 'tables') {
var btnText = btn.children[0];
btnText.text = 'MAX TABLES';
btn.alpha = 0.5;
btn.down = null;
break;
}
}
} else if (type === 'lighting') {
// For lighting, temporarily show feedback on the button
for (var i = 0; i < shopButtons.length; i++) {
var btn = shopButtons[i];
if (btn.itemType === 'lighting') {
var btnText = btn.children[0];
var originalText = btnText.text;
btnText.text = 'ADDED!';
LK.setTimeout(function () {
btnText.text = originalText;
}, 1000);
break;
}
}
}
// Don't close shop immediately - let player continue shopping
console.log("Item purchased successfully!");
} else {
console.log("Not enough money for " + type + " - need $" + price);
}
}
// Animatronics shop items
var animatronicsItems = [{
name: 'George Droyd',
price: 500000,
type: 'georgeDroyd',
description: 'A mysterious animatronic for the stage'
}];
var animatronicsPurchased = {
securityBear: false,
dancingChicken: false,
musicBoxPuppet: false,
goldenFreddy: false,
georgeDroyd: false
};
function openAnimatronicsShop() {
// Clear existing animatronics shop buttons
for (var i = 0; i < animatronicsShopButtons.length; i++) {
animatronicsShopButtons[i].destroy();
}
animatronicsShopButtons = [];
// Check if game is zoomed and adjust panel accordingly
if (game.scaleX && game.scaleX <= 0.7) {
animatronicsShopPanel.scaleX = 1.43;
animatronicsShopPanel.scaleY = 1.43;
animatronicsShopPanel.x = 1024 / 0.7;
animatronicsShopPanel.y = 1366 / 0.7;
} else {
animatronicsShopPanel.scaleX = 1;
animatronicsShopPanel.scaleY = 1;
animatronicsShopPanel.x = 1024;
animatronicsShopPanel.y = 1366;
}
// Create animatronics shop title
var titleText = animatronicsShopPanel.addChild(new Text2('ANIMATRONICS SHOP', {
size: 60,
fill: 0xFFFFFF
}));
titleText.anchor.set(0.5, 0.5);
titleText.x = 0;
titleText.y = -600;
animatronicsShopButtons.push(titleText);
// Create item buttons
for (var i = 0; i < animatronicsItems.length; i++) {
var item = animatronicsItems[i];
var btn = animatronicsShopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -400 + i * 150,
width: 600,
height: 100,
color: 0x4A148C
}));
var btnTxt = new Text2(item.name + ' - $' + item.price, {
size: 28,
fill: 0xFFFFFF
});
btnTxt.anchor.set(0.5, 0.3);
btn.addChild(btnTxt);
var descTxt = new Text2(item.description, {
size: 20,
fill: 0xCCCCCC
});
descTxt.anchor.set(0.5, 0.7);
btn.addChild(descTxt);
btn.itemType = item.type;
btn.itemPrice = item.price;
// Check if already purchased
if (animatronicsPurchased[item.type]) {
btnTxt.text = 'PURCHASED';
btn.alpha = 0.5;
btn.down = null;
} else {
btn.down = function (itemType, itemPrice) {
return function (x, y, obj) {
purchaseAnimatronic(itemType, itemPrice);
};
}(item.type, item.price);
}
animatronicsShopButtons.push(btn);
}
// Close button
var closeBtn = animatronicsShopPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 600,
color: 0xFF6B6B
}));
var closeTxt = new Text2('CLOSE', {
size: 40,
fill: 0xFFFFFF
});
closeTxt.anchor.set(0.5, 0.5);
closeBtn.addChild(closeTxt);
closeBtn.down = function (x, y, obj) {
closeAnimatronicsShop();
};
animatronicsShopButtons.push(closeBtn);
animatronicsShopOpen = true;
animatronicsShopPanel.visible = true;
// Hide all game elements
restaurant.visible = false;
leftWall.visible = false;
rightWall.visible = false;
topWall.visible = false;
bottomWall.visible = false;
shopBtn.visible = false;
for (var i = 0; i < tables.length; i++) {
tables[i].visible = false;
}
for (var i = 0; i < customers.length; i++) {
customers[i].visible = false;
}
for (var i = 0; i < gameMachines.length; i++) {
gameMachines[i].visible = false;
}
for (var i = 0; i < decorations.length; i++) {
decorations[i].visible = false;
}
for (var i = 0; i < soundSystems.length; i++) {
soundSystems[i].visible = false;
}
for (var i = 0; i < lightingKits.length; i++) {
lightingKits[i].visible = false;
}
for (var i = 0; i < vipSections.length; i++) {
vipSections[i].visible = false;
}
for (var i = 0; i < kitchenUpgrades.length; i++) {
kitchenUpgrades[i].visible = false;
}
for (var i = 0; i < chefs.length; i++) {
chefs[i].visible = false;
}
for (var i = 0; i < stages.length; i++) {
stages[i].visible = false;
}
if (upgrade1Btn && upgrade1Btn.parent) {
upgrade1Btn.visible = false;
}
tween(animatronicsShopPanel, {
alpha: 1
}, {
duration: 300
});
}
function closeAnimatronicsShop() {
animatronicsShopOpen = false;
tween(animatronicsShopPanel, {
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
animatronicsShopPanel.visible = false;
// Show all game elements
restaurant.visible = true;
leftWall.visible = true;
rightWall.visible = true;
topWall.visible = true;
bottomWall.visible = true;
shopBtn.visible = true;
for (var i = 0; i < tables.length; i++) {
tables[i].visible = true;
}
for (var i = 0; i < customers.length; i++) {
customers[i].visible = true;
}
for (var i = 0; i < gameMachines.length; i++) {
gameMachines[i].visible = true;
}
for (var i = 0; i < decorations.length; i++) {
decorations[i].visible = true;
}
for (var i = 0; i < soundSystems.length; i++) {
soundSystems[i].visible = true;
}
for (var i = 0; i < lightingKits.length; i++) {
lightingKits[i].visible = true;
}
for (var i = 0; i < vipSections.length; i++) {
vipSections[i].visible = true;
}
for (var i = 0; i < kitchenUpgrades.length; i++) {
kitchenUpgrades[i].visible = true;
}
for (var i = 0; i < chefs.length; i++) {
chefs[i].visible = true;
}
for (var i = 0; i < stages.length; i++) {
stages[i].visible = true;
}
if (upgrade1Btn && upgrade1Btn.parent) {
upgrade1Btn.visible = true;
}
}
});
}
function purchaseAnimatronic(type, price) {
if (animatronicsPurchased[type]) {
console.log("Animatronic already purchased!");
return;
}
if (money >= price) {
money -= price;
moneyTxt.setText('$' + money);
LK.getSound('purchase').play();
animatronicsPurchased[type] = true;
// Apply animatronic effects
if (type === 'georgeDroyd') {
// Add George Droyd animatronic to the stage
if (stages.length > 0) {
var georgeDroyd = stages[0].addChild(LK.getAsset('georgeDroyd', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -50
}));
restaurantQuality += 3;
baseCustomerSpawn += 5;
fancyCustomerSpawn += 2;
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 2;
}
} else if (type === 'securityBear') {
restaurantQuality += 1.5;
baseCustomerSpawn += 1;
} else if (type === 'dancingChicken') {
restaurantQuality += 2;
baseCustomerSpawn += 2;
fancyCustomerSpawn += 1;
} else if (type === 'musicBoxPuppet') {
restaurantQuality += 2.5;
baseCustomerSpawn += 1;
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 2;
} else if (type === 'goldenFreddy') {
restaurantQuality += 5;
baseCustomerSpawn += 3;
fancyCustomerSpawn += 2;
if (!window.kidCustomerSpawn) window.kidCustomerSpawn = 0;
window.kidCustomerSpawn += 1;
}
// Update button to show purchased
for (var i = 0; i < animatronicsShopButtons.length; i++) {
var btn = animatronicsShopButtons[i];
if (btn.itemType === type) {
var btnText = btn.children[0];
btnText.text = 'PURCHASED';
btn.alpha = 0.5;
btn.down = null;
break;
}
}
console.log("Animatronic purchased successfully!");
} else {
console.log("Not enough money for " + type + " - need $" + price);
}
}
function spawnCustomer() {
var totalCustomerLimit = baseCustomerSpawn + fancyCustomerSpawn;
var maxCustomers = Math.floor(restaurantQuality * 2) + totalCustomerLimit;
// Spawn multiple customers based on upgrade bonuses
var customersToSpawn = 1;
if (baseCustomerSpawn > 2) {
customersToSpawn += Math.floor((baseCustomerSpawn - 2) * 0.5); // Extra customers from regular upgrades
}
if (fancyCustomerSpawn > 0) {
customersToSpawn += Math.floor(fancyCustomerSpawn * 0.3); // Extra customers from fancy upgrades
}
for (var spawn = 0; spawn < customersToSpawn && customers.length < maxCustomers; spawn++) {
var customer = new Customer();
customer.x = -100 - spawn * 50; // Stagger spawn positions
customer.y = 1400 + Math.random() * 200;
customer.satisfaction = Math.min(restaurantQuality / 5, 2);
// Determine customer type based on spawn bonuses
var fancyChance = fancyCustomerSpawn > 0 ? Math.min(0.3 + fancyCustomerSpawn * 0.1, 0.7) : 0;
var kidChance = window.kidCustomerSpawn > 0 ? Math.min(0.2 + window.kidCustomerSpawn * 0.1, 0.5) : 0;
// Replace regular customer with Kid67Customer if it should be a kid
if (window.kidCustomerSpawn > 0 && Math.random() < kidChance) {
// Remove the regular customer and create a Kid67Customer instead
game.removeChild(customer);
customers.pop(); // Remove from array since we just added it
customer = new Kid67Customer();
customer.x = -100 - spawn * 50;
customer.y = 1400 + Math.random() * 200;
customer.satisfaction = Math.min(restaurantQuality / 5, 2) * 0.67; // 67% satisfaction
game.addChild(customer);
customers.push(customer);
} else if (fancyCustomerSpawn > 0 && Math.random() < fancyChance) {
customer.satisfaction *= 1.5; // Fancy customers have higher satisfaction
customer.tint = 0xFFD700; // Gold tint for fancy customers
}
game.addChild(customer);
customers.push(customer);
LK.getSound('customerEnter').play();
// Move customer into restaurant with slight delay for each spawn
LK.setTimeout(function (customerRef) {
return function () {
tween(customerRef, {
x: 200 + Math.random() * 1600
}, {
duration: 2000
});
};
}(customer), spawn * 200); // 200ms delay between each customer
}
}
createShopButtons();
// Admin button in right bottom corner
var adminBtn = game.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 1900,
y: 2600,
color: 0xFF4500
}));
var adminBtnTxt = new Text2('ADMIN', {
size: 30,
fill: 0xFFFFFF
});
adminBtnTxt.anchor.set(0.5, 0.5);
adminBtn.addChild(adminBtnTxt);
// Password input system variables
var passwordPanel = null;
var passwordInput = "";
var passwordInputText = null;
adminBtn.down = function (x, y, obj) {
showPasswordPrompt();
};
function showPasswordPrompt() {
// Create password panel
passwordPanel = game.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
width: 800,
height: 400,
color: 0x000000
}));
passwordPanel.tint = 0x000000;
// Check if game is zoomed out and apply inverse zoom to maintain stable position
if (game.scaleX && game.scaleX <= 0.7) {
passwordPanel.scaleX = 1.43;
// 1/0.7 to counteract game zoom
passwordPanel.scaleY = 1.43;
passwordPanel.x = 1024 / 0.7;
// Adjust position for zoom
passwordPanel.y = 1366 / 0.7;
}
// Password title
var passwordTitle = passwordPanel.addChild(new Text2('Enter Admin Password', {
size: 40,
fill: 0xFFFFFF
}));
passwordTitle.anchor.set(0.5, 0.5);
passwordTitle.x = 0;
passwordTitle.y = -120;
// Password display
passwordInputText = passwordPanel.addChild(new Text2('', {
size: 50,
fill: 0xFFFFFF
}));
passwordInputText.anchor.set(0.5, 0.5);
passwordInputText.x = 0;
passwordInputText.y = -40;
// Number buttons (0-9)
var numberButtons = [];
for (var i = 0; i <= 9; i++) {
var numBtn = passwordPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -200 + i % 5 * 100,
y: 20 + Math.floor(i / 5) * 80,
width: 80,
height: 60,
color: 0x3498DB
}));
var numTxt = new Text2(i.toString(), {
size: 30,
fill: 0xFFFFFF
});
numTxt.anchor.set(0.5, 0.5);
numBtn.addChild(numTxt);
// Use closure to capture number value
numBtn.down = function (num) {
return function (x, y, obj) {
if (passwordInput.length < 10) {
passwordInput += num.toString();
updatePasswordDisplay();
}
};
}(i);
numberButtons.push(numBtn);
}
// Clear button
var clearBtn = passwordPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: -150,
y: 160,
width: 100,
height: 60,
color: 0xE74C3C
}));
var clearTxt = new Text2('CLEAR', {
size: 25,
fill: 0xFFFFFF
});
clearTxt.anchor.set(0.5, 0.5);
clearBtn.addChild(clearTxt);
clearBtn.down = function (x, y, obj) {
passwordInput = "";
updatePasswordDisplay();
};
// Submit button
var submitBtn = passwordPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 160,
width: 100,
height: 60,
color: 0x27AE60
}));
var submitTxt = new Text2('ENTER', {
size: 25,
fill: 0xFFFFFF
});
submitTxt.anchor.set(0.5, 0.5);
submitBtn.addChild(submitTxt);
submitBtn.down = function (x, y, obj) {
if (passwordInput === "973451") {
console.log("Admin access granted!");
// Add admin functionality here
hidePasswordPrompt();
showInfiniteMoneyButton();
} else if (passwordInput) {
console.log("Incorrect password");
hidePasswordPrompt();
} else {
console.log("No password entered");
}
};
// Cancel button
var cancelBtn = passwordPanel.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 150,
y: 160,
width: 100,
height: 60,
color: 0x95A5A6
}));
var cancelTxt = new Text2('CANCEL', {
size: 25,
fill: 0xFFFFFF
});
cancelTxt.anchor.set(0.5, 0.5);
cancelBtn.addChild(cancelTxt);
cancelBtn.down = function (x, y, obj) {
console.log("Password prompt cancelled");
hidePasswordPrompt();
};
}
function updatePasswordDisplay() {
var displayText = "";
for (var i = 0; i < passwordInput.length; i++) {
displayText += "*";
}
if (passwordInputText) {
passwordInputText.setText(displayText);
}
}
function hidePasswordPrompt() {
if (passwordPanel) {
passwordPanel.destroy();
passwordPanel = null;
passwordInput = "";
passwordInputText = null;
}
}
function showInfiniteMoneyButton() {
// Create infinite money button at the very bottom of screen
var infMoneyBtn = game.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: game.scaleX && game.scaleX <= 0.7 ? 1024 / 0.7 : 1024,
y: game.scaleX && game.scaleX <= 0.7 ? 2680 / 0.7 : 2680,
width: 300,
height: 60,
color: 0xFFD700,
scaleX: game.scaleX && game.scaleX <= 0.7 ? 1.43 : 1,
scaleY: game.scaleX && game.scaleX <= 0.7 ? 1.43 : 1
}));
var infMoneyTxt = new Text2('INF MONEY', {
size: 30,
fill: 0x000000
});
infMoneyTxt.anchor.set(0.5, 0.5);
infMoneyBtn.addChild(infMoneyTxt);
infMoneyBtn.down = function (x, y, obj) {
money = 999000000;
moneyTxt.setText('$' + money);
console.log("Infinite money activated!");
};
}
var inPinkSlip = false;
var pinkSlipContainer = null;
function goToPinkSlip() {
// Close shop first
closeShop();
// Set Pink Slip state
inPinkSlip = true;
// Hide all main game elements completely
hideAllGameElements();
// Create completely independent Pink Slip environment
createPinkSlipEnvironment();
console.log("Welcome to Pink Slip Office!");
}
function createPinkSlipEnvironment() {
// Create new independent game container for Pink Slip that covers full screen
pinkSlipContainer = new Container();
pinkSlipContainer.x = 0;
pinkSlipContainer.y = 0;
game.addChild(pinkSlipContainer);
// Set different background color for Pink Slip
game.setBackgroundColor(0x1C1C1C);
// Create Pink Slip office background that covers full screen with proper scaling
var officeBg = pinkSlipContainer.addChild(LK.getAsset('officeBackground', {
anchorX: 0.5,
anchorY: 0.5,
x: 1024,
y: 1366,
scaleX: 1.0,
scaleY: 1.0
}));
// Scale office background to ensure full screen coverage beyond viewport
officeBg.scaleX = 2.5;
officeBg.scaleY = 2.5;
// Scale entire Pink Slip container to ensure full coverage
pinkSlipContainer.scaleX = 2.0;
pinkSlipContainer.scaleY = 2.0;
// Position container to fill entire game area
pinkSlipContainer.x = 0;
pinkSlipContainer.y = 0;
// Office ceiling with fluorescent lighting effect - extend to cover full width
var ceiling = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -1366,
width: 6000,
height: 800,
color: 0x1A1A1A
}));
// Add fluorescent light strips
for (var lightIndex = 0; lightIndex < 5; lightIndex++) {
var lightStrip = ceiling.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: -800 + lightIndex * 400,
y: 50,
width: 300,
height: 40,
color: 0xF0F0F0
}));
}
// Office carpet floor - extend to cover full screen bottom
var carpet = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 1366,
width: 6000,
height: 800,
color: 0x444444
}));
// Office title with corporate styling
var officeTitle = officeBg.addChild(new Text2('CORPORATE HEADQUARTERS', {
size: 50,
fill: 0xCCCCCC
}));
officeTitle.anchor.set(0.5, 0.5);
officeTitle.x = 0;
officeTitle.y = -950;
var subTitle = officeBg.addChild(new Text2('Pink Slip Division', {
size: 30,
fill: 0x888888
}));
subTitle.anchor.set(0.5, 0.5);
subTitle.x = 0;
subTitle.y = -900;
// Executive mahogany desk
var executiveDesk = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -150,
width: 800,
height: 200,
color: 0x654321
}));
// Desk lamp
var deskLamp = executiveDesk.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 1.0,
x: 250,
y: -100,
width: 60,
height: 120,
color: 0x2C2C2C
}));
// Lamp light cone
var lampLight = deskLamp.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0,
x: 0,
y: -120,
width: 150,
height: 80,
color: 0xFFFF99
}));
lampLight.alpha = 0.3;
// Palestine Flag on executive stand
var flagStand = executiveDesk.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 1.0,
x: -200,
y: -100,
width: 20,
height: 180,
color: 0x8B4513
}));
var palestineFlag = flagStand.addChild(LK.getAsset('shopPanel', {
anchorX: 0,
anchorY: 1.0,
x: 10,
y: -160,
width: 250,
height: 150,
color: 0x009639
}));
// Flag stripes
var whiteStripe = palestineFlag.addChild(LK.getAsset('shopPanel', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: 0,
width: 250,
height: 50,
color: 0xFFFFFF
}));
var blackStripe = palestineFlag.addChild(LK.getAsset('shopPanel', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: 50,
width: 250,
height: 50,
color: 0x000000
}));
// Red triangle
var redTriangle = palestineFlag.addChild(LK.getAsset('shopPanel', {
anchorX: 0,
anchorY: 0.5,
x: 0,
y: 25,
width: 100,
height: 100,
color: 0xCE1126
}));
// Executive leather chair
var executiveChair = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 100,
width: 150,
height: 250,
color: 0x4A4A4A
}));
// High-tech computer setup
var computerMonitor = executiveDesk.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 1.0,
x: 50,
y: -100,
width: 200,
height: 150,
color: 0x000000
}));
var computerScreen = computerMonitor.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -40,
width: 180,
height: 120,
color: 0x003366
}));
// Computer text display
var computerText = computerScreen.addChild(new Text2('TERMINATION\nPROCESSING...', {
size: 16,
fill: 0x00FF00
}));
computerText.anchor.set(0.5, 0.5);
computerText.x = 0;
computerText.y = 0;
// Floor-to-ceiling windows with city view
var leftWindow = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: -700,
y: -300,
width: 250,
height: 800,
color: 0x87CEEB
}));
var rightWindow = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 700,
y: -300,
width: 250,
height: 800,
color: 0x87CEEB
}));
// Add window frames
for (var frameIndex = 0; frameIndex < 2; frameIndex++) {
var window = frameIndex === 0 ? leftWindow : rightWindow;
var windowFrame = window.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
width: 260,
height: 810,
color: 0x333333
}));
windowFrame.alpha = 0.3;
}
// Corporate filing system
var leftFiling = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: -900,
y: 300,
width: 200,
height: 500,
color: 0x696969
}));
var rightFiling = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 900,
y: 300,
width: 200,
height: 500,
color: 0x696969
}));
// Corporate motivational artwork
var artwork1 = officeBg.addChild(new Text2('EFFICIENCY', {
size: 35,
fill: 0xAAAAAA
}));
artwork1.anchor.set(0.5, 0.5);
artwork1.x = -400;
artwork1.y = -700;
var artwork2 = officeBg.addChild(new Text2('EXCELLENCE', {
size: 35,
fill: 0xAAAAAA
}));
artwork2.anchor.set(0.5, 0.5);
artwork2.x = 400;
artwork2.y = -700;
var artwork3 = officeBg.addChild(new Text2('RESULTS', {
size: 35,
fill: 0xAAAAAA
}));
artwork3.anchor.set(0.5, 0.5);
artwork3.x = 0;
artwork3.y = -650;
// Corporate coffee area
var coffeeTable = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: -400,
y: 400,
width: 120,
height: 120,
color: 0x8B4513
}));
var coffeeMachine = coffeeTable.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 1.0,
x: 0,
y: -60,
width: 80,
height: 100,
color: 0x2C2C2C
}));
// Security camera
var securityCamera = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 600,
y: -800,
width: 60,
height: 40,
color: 0x1C1C1C
}));
// Red recording light
var recordingLight = securityCamera.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
width: 10,
height: 10,
color: 0xFF0000
}));
// Make recording light blink
tween(recordingLight, {
alpha: 0
}, {
duration: 1000,
loop: true,
yoyo: true
});
// Large corporate logo/portrait in center of office
var corporateImage = officeBg.addChild(LK.getAsset('corporatePortrait', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 250,
scaleX: 1.0,
scaleY: 1.0
}));
// Add elegant frame around the corporate image
var imageFrame = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 250,
width: 450,
height: 450,
color: 0x8B4513
}));
// Add inner frame border
var innerFrame = imageFrame.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 0,
width: 420,
height: 420,
color: 0xFFD700
}));
// Move the corporate image to be on top of the frame
corporateImage.parent.removeChild(corporateImage);
innerFrame.addChild(corporateImage);
corporateImage.x = 0;
corporateImage.y = 0;
// Add nameplate below the portrait
var nameplate = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 500,
width: 300,
height: 60,
color: 0x2F4F4F
}));
var nameplateText = nameplate.addChild(new Text2('CHIEF EXECUTIVE', {
size: 24,
fill: 0xFFFFFF
}));
nameplateText.anchor.set(0.5, 0.5);
nameplateText.x = 0;
nameplateText.y = 0;
// Return to restaurant button with corporate styling
var returnBtn = officeBg.addChild(LK.getAsset('upgradeButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 900,
color: 0x8B0000,
width: 500,
height: 100
}));
var returnTxt = new Text2('EXIT BUILDING', {
size: 32,
fill: 0xFFFFFF
});
returnTxt.anchor.set(0.5, 0.5);
returnBtn.addChild(returnTxt);
returnBtn.down = function (x, y, obj) {
returnToRestaurant();
};
// Add ambient office sounds simulation
LK.setTimeout(function () {
if (inPinkSlip) {
// Simulate office ambience by changing computer text periodically
var officeTexts = ['TERMINATION\nPROCESSING...', 'EMPLOYEE\nEVALUATION', 'COST REDUCTION\nANALYSIS', 'PRODUCTIVITY\nMETRICS', 'DOWNSIZING\nPLAN'];
var currentTextIndex = 0;
LK.setInterval(function () {
if (inPinkSlip && computerText) {
currentTextIndex = (currentTextIndex + 1) % officeTexts.length;
computerText.setText(officeTexts[currentTextIndex]);
}
}, 3000);
}
}, 1000);
}
function hideAllGameElements() {
// Hide restaurant environment
restaurant.visible = false;
leftWall.visible = false;
rightWall.visible = false;
topWall.visible = false;
bottomWall.visible = false;
// Hide UI buttons
shopBtn.visible = false;
adminBtn.visible = false;
if (upgrade1Btn && upgrade1Btn.parent) {
upgrade1Btn.visible = false;
}
// Hide all tables
for (var i = 0; i < tables.length; i++) {
tables[i].visible = false;
}
// Hide all customers
for (var i = 0; i < customers.length; i++) {
customers[i].visible = false;
}
// Hide all equipment
for (var i = 0; i < gameMachines.length; i++) {
gameMachines[i].visible = false;
}
for (var i = 0; i < decorations.length; i++) {
decorations[i].visible = false;
}
for (var i = 0; i < soundSystems.length; i++) {
soundSystems[i].visible = false;
}
for (var i = 0; i < lightingKits.length; i++) {
lightingKits[i].visible = false;
}
for (var i = 0; i < vipSections.length; i++) {
vipSections[i].visible = false;
}
for (var i = 0; i < kitchenUpgrades.length; i++) {
kitchenUpgrades[i].visible = false;
}
for (var i = 0; i < chefs.length; i++) {
chefs[i].visible = false;
}
for (var i = 0; i < stages.length; i++) {
stages[i].visible = false;
}
}
function showAllGameElements() {
// Show restaurant environment
restaurant.visible = true;
leftWall.visible = true;
rightWall.visible = true;
topWall.visible = true;
bottomWall.visible = true;
// Show UI buttons
shopBtn.visible = true;
adminBtn.visible = true;
if (upgrade1Btn && upgrade1Btn.parent) {
upgrade1Btn.visible = true;
}
// Show all tables
for (var i = 0; i < tables.length; i++) {
tables[i].visible = true;
}
// Show all customers
for (var i = 0; i < customers.length; i++) {
customers[i].visible = true;
}
// Show all equipment
for (var i = 0; i < gameMachines.length; i++) {
gameMachines[i].visible = true;
}
for (var i = 0; i < decorations.length; i++) {
decorations[i].visible = true;
}
for (var i = 0; i < soundSystems.length; i++) {
soundSystems[i].visible = true;
}
for (var i = 0; i < lightingKits.length; i++) {
lightingKits[i].visible = true;
}
for (var i = 0; i < vipSections.length; i++) {
vipSections[i].visible = true;
}
for (var i = 0; i < kitchenUpgrades.length; i++) {
kitchenUpgrades[i].visible = true;
}
for (var i = 0; i < chefs.length; i++) {
chefs[i].visible = true;
}
for (var i = 0; i < stages.length; i++) {
stages[i].visible = true;
}
}
function returnToRestaurant() {
// Set state back to restaurant
inPinkSlip = false;
// Destroy Pink Slip environment completely
if (pinkSlipContainer) {
pinkSlipContainer.destroy();
pinkSlipContainer = null;
}
// Restore restaurant background
game.setBackgroundColor(0x90EE90);
// Show all main game elements
showAllGameElements();
}
// Play background music
LK.playMusic('backgroundMusic');
game.update = function () {
// Skip all main game logic while in Pink Slip
if (inPinkSlip) {
return;
}
// Spawn customers based on restaurant quality and upgrades
var baseSpawnRate = Math.max(300 - restaurantQuality * 20, 240);
var upgradeSpawnBonus = (baseCustomerSpawn - 2) * 30 + fancyCustomerSpawn * 20; // Faster spawn for each upgrade
var finalSpawnRate = Math.max(baseSpawnRate - upgradeSpawnBonus, 120); // Minimum 120 ticks (2 seconds)
if (LK.ticks - lastCustomerSpawn > finalSpawnRate) {
spawnCustomer();
lastCustomerSpawn = LK.ticks;
}
// Update customer satisfaction based on restaurant items
for (var i = 0; i < customers.length; i++) {
var customer = customers[i];
var nearbyQuality = 1;
// Check proximity to tables
for (var j = 0; j < tables.length; j++) {
var table = tables[j];
var distance = Math.sqrt((customer.x - table.x) * (customer.x - table.x) + (customer.y - table.y) * (customer.y - table.y));
if (distance < 300) {
nearbyQuality += table.qualityBonus * 0.1;
}
}
// Check proximity to game machines
for (var k = 0; k < gameMachines.length; k++) {
var machine = gameMachines[k];
var distance = Math.sqrt((customer.x - machine.x) * (customer.x - machine.x) + (customer.y - machine.y) * (customer.y - machine.y));
if (distance < 400) {
nearbyQuality += machine.qualityBonus * 0.1;
// Machine specific interactions
if (machine.customersBonus && distance < 200 && Math.random() < 0.05) {
// Mark customer as playing to prevent multiple interactions
if (!customer.isPlaying) {
customer.isPlaying = true;
// Check if this is a mango juice machine
var isMangoJuice = machine.x === 1750 && machine.y === 1900;
if (isMangoJuice) {
// Mango juice machine interaction
// Move customer closer to machine
tween(customer, {
x: machine.x - 60,
y: machine.y + 50
}, {
duration: 600,
onFinish: function onFinish() {
// Customer drinks mango juice - sip animation
tween(customer, {
scaleY: 0.9,
rotation: -0.2
}, {
duration: 300,
easing: tween.easeInOut,
onFinish: function onFinish() {
// Return to normal while drinking
tween(customer, {
scaleY: 1,
rotation: 0
}, {
duration: 300,
onFinish: function onFinish() {
// Happy jump after drinking
tween(customer, {
y: customer.y - 30,
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
// Land back down
tween(customer, {
y: customer.y + 30,
scaleX: 1,
scaleY: 1
}, {
duration: 200,
easing: tween.bounceOut,
onFinish: function onFinish() {
customer.isPlaying = false;
// Move customer away from machine
tween(customer, {
x: customer.x + Math.random() * 200 - 100,
y: customer.y + Math.random() * 100 - 50
}, {
duration: 1200
});
}
});
}
});
}
});
}
});
// Flash machine orange for mango effect
tween(machine, {
tint: 0xFFA500
}, {
duration: 400,
onFinish: function onFinish() {
tween(machine, {
tint: 0xFFFFFF
}, {
duration: 400
});
}
});
}
});
} else {
// Basketball machine interaction (existing code)
// Move customer closer to machine
tween(customer, {
x: machine.x + 50,
y: machine.y + 80
}, {
duration: 800,
onFinish: function onFinish() {
// Customer plays basketball - bounce animation
tween(customer, {
scaleX: 1.3,
scaleY: 0.8,
y: customer.y - 20
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
// Bounce back down
tween(customer, {
scaleX: 1.1,
scaleY: 1.1,
y: customer.y + 20
}, {
duration: 200,
easing: tween.bounceOut,
onFinish: function onFinish() {
// Flash machine to show successful shot
tween(machine, {
tint: 0x00FF00
}, {
duration: 300,
onFinish: function onFinish() {
tween(machine, {
tint: 0xFFFFFF
}, {
duration: 300
});
}
});
// Return customer to normal size
tween(customer, {
scaleX: 1,
scaleY: 1
}, {
duration: 300,
onFinish: function onFinish() {
customer.isPlaying = false;
// Move customer away from machine
tween(customer, {
x: customer.x + Math.random() * 200 - 100,
y: customer.y + Math.random() * 100 - 50
}, {
duration: 1000
});
}
});
}
});
}
});
}
});
}
// Add bonus customers when someone plays
if (LK.ticks - machine.lastPlayerTime > 600) {
machine.lastPlayerTime = LK.ticks;
baseCustomerSpawn += machine.customersBonus;
LK.setTimeout(function () {
baseCustomerSpawn -= machine.customersBonus;
}, 3000);
}
// Give extra money for machine interaction
money += isMangoJuice ? 8 : 5;
moneyTxt.setText('$' + money);
// Play interaction sound effect
LK.getSound('customerEnter').play();
}
}
}
}
customer.satisfaction = Math.min(customer.satisfaction * nearbyQuality, 3);
// Add stage watching behavior for regular customers
if (stages.length > 0 && !customer.currentTable && !customer.watchingStage) {
var stage = stages[0];
var distanceToStage = Math.sqrt((customer.x - stage.x) * (customer.x - stage.x) + (customer.y - stage.y) * (customer.y - stage.y));
// 20% chance for regular customers to watch stage
if (Math.random() < 0.02 && customer.timeInRestaurant > 120) {
customer.watchingStage = true;
customer.stageWatchTime = 0;
// Move to watch stage
tween(customer, {
x: stage.x + (Math.random() - 0.5) * 400,
y: stage.y + 180
}, {
duration: 2000
});
}
}
// Handle stage watching for regular customers
if (customer.watchingStage && !customer.currentTable) {
customer.stageWatchTime = (customer.stageWatchTime || 0) + 1;
// Watch for 2-4 seconds then find table
if (customer.stageWatchTime > 120 + Math.random() * 120) {
customer.watchingStage = false;
// Try to find table after watching
for (var j = 0; j < tables.length; j++) {
var table = tables[j];
if (!table.occupied) {
customer.currentTable = table;
table.occupied = true;
if (!table.food) {
table.food = table.addChild(LK.getAsset('food', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: -30
}));
table.food.scaleX = 0;
table.food.scaleY = 0;
tween(table.food, {
scaleX: 1,
scaleY: 1
}, {
duration: 500
});
}
tween(customer, {
x: table.x,
y: table.y + 100
}, {
duration: 1000
});
break;
}
}
}
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -2176,15 +2176,15 @@
loop: true,
yoyo: true
});
// Large corporate logo/portrait in center of office
- var corporateImage = officeBg.addChild(LK.getAsset('georgeDroyd', {
+ var corporateImage = officeBg.addChild(LK.getAsset('corporatePortrait', {
anchorX: 0.5,
anchorY: 0.5,
x: 0,
y: 250,
- scaleX: 4.0,
- scaleY: 4.0
+ scaleX: 1.0,
+ scaleY: 1.0
}));
// Add elegant frame around the corporate image
var imageFrame = officeBg.addChild(LK.getAsset('shopPanel', {
anchorX: 0.5,