User prompt
raf sayısı baslangıçta 4 raf olsun
User prompt
baslangıçta 1 kasa olsun
User prompt
expand store düğmesine basıldığında level artsın level artınca herşeyin fiyatı yüzde 150 artsın
User prompt
ve başlangıçta 4 kasa olsun
User prompt
oyun başlangıçta level 1 den 20 dolar olarak başlasın
User prompt
büyük düğmeyi biraz üste al
User prompt
o düğmeyi şimdi kaldır
User prompt
levelı sıfırla
User prompt
üst üste olmasınlar
User prompt
kasiyer düğmesiyle expand store düğmesini hizala
User prompt
shift düğmesini kaldır
User prompt
butonlar üst üste gelmesin
User prompt
biraz sıfırla buyuk butonu
User prompt
büyük butonu biraz daha aşağı al
User prompt
fontunu biraz küçült butonun
User prompt
büyük butonu asağıya taşı tüm butonların altına
User prompt
bakiyemi sıfırla
User prompt
dükkanın sınırlarını genişleten bir butonda ekle diğer butonlardan büyük olsun ve parası 575 olsun
User prompt
her shift tusuna bastığımda bana 1000 dolar para ver
User prompt
butonlara shift tusu mouse sol tık ile basılınca 1000 para ve
User prompt
bu oyuna bir hile kodu ekle
User prompt
kasiyer 175
User prompt
restock 100 olsun
User prompt
expand tuşuna basıldığında eklenen kasaları mevcut olan kasaların yanına koy
User prompt
her kesinti oldugunda bakiyenin yanında -2 yazsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Cashier = Container.expand(function () {
var self = Container.call(this);
// Create cashier counter
var counter = self.addChild(LK.getAsset('cashierCounter', {
anchorX: 0.5,
anchorY: 0.5
}));
// Create human-like cashier
var head = self.addChild(LK.getAsset('cashierHead', {
anchorX: 0.5,
anchorY: 0.5
}));
head.y = -35;
var body = self.addChild(LK.getAsset('cashierBody', {
anchorX: 0.5,
anchorY: 0.5
}));
body.y = -15;
var leftArm = self.addChild(LK.getAsset('cashierArm', {
anchorX: 0.5,
anchorY: 0
}));
leftArm.x = -12;
leftArm.y = -22;
var rightArm = self.addChild(LK.getAsset('cashierArm', {
anchorX: 0.5,
anchorY: 0
}));
rightArm.x = 12;
rightArm.y = -22;
self.bodyParts = {
head: head,
body: body,
leftArm: leftArm,
rightArm: rightArm
};
self.isProcessing = false;
self.processingTimer = 0;
self.processCustomer = function (customer) {
if (!self.isProcessing) {
self.isProcessing = true;
self.processingTimer = 60; // 1 second processing time
// Animate cashier working
tween(self.bodyParts.rightArm, {
rotation: -0.5
}, {
duration: 300,
onComplete: function onComplete() {
tween(self.bodyParts.rightArm, {
rotation: 0
}, {
duration: 300
});
}
});
}
};
self.update = function () {
if (self.isProcessing) {
self.processingTimer--;
if (self.processingTimer <= 0) {
self.isProcessing = false;
}
// Slight head bob while processing
self.bodyParts.head.y = -35 + Math.sin(LK.ticks * 0.3) * 1;
} else {
self.bodyParts.head.y = -35;
}
};
return self;
});
var Customer = Container.expand(function () {
var self = Container.call(this);
// Create human-like customer with body parts
var head = self.addChild(LK.getAsset('customerHead', {
anchorX: 0.5,
anchorY: 0.5
}));
head.y = -20;
var body = self.addChild(LK.getAsset('customerBody', {
anchorX: 0.5,
anchorY: 0.5
}));
body.y = 0;
var leftArm = self.addChild(LK.getAsset('customerArm', {
anchorX: 0.5,
anchorY: 0
}));
leftArm.x = -15;
leftArm.y = -8;
var rightArm = self.addChild(LK.getAsset('customerArm', {
anchorX: 0.5,
anchorY: 0
}));
rightArm.x = 15;
rightArm.y = -8;
var leftLeg = self.addChild(LK.getAsset('customerLeg', {
anchorX: 0.5,
anchorY: 0
}));
leftLeg.x = -8;
leftLeg.y = 16;
var rightLeg = self.addChild(LK.getAsset('customerLeg', {
anchorX: 0.5,
anchorY: 0
}));
rightLeg.x = 8;
rightLeg.y = 16;
// Store body parts for animation
self.bodyParts = {
head: head,
body: body,
leftArm: leftArm,
rightArm: rightArm,
leftLeg: leftLeg,
rightLeg: rightLeg
};
self.speed = 1 + Math.random() * 2;
self.targetShelf = null;
self.state = 'browsing'; // browsing, shopping, checkout, leaving
self.patience = 300 + Math.random() * 200;
self.maxPatience = self.patience;
self.walkCycle = 0;
self.shoppingCart = [];
self.hasComplained = false;
self.complain = function () {
// Visual complaint effect - flash red
LK.effects.flashObject(self, 0xff0000, 800);
// Create complaint text above customer
var complaintText = new Text2('No products!', {
size: 20,
fill: 0xff0000
});
complaintText.anchor.set(0.5, 1);
complaintText.x = self.x;
complaintText.y = self.y - 40;
game.addChild(complaintText);
// Animate complaint text
tween(complaintText, {
y: complaintText.y - 30,
alpha: 0
}, {
duration: 1500,
onComplete: function onComplete() {
complaintText.destroy();
}
});
// Reduce customer patience significantly
self.patience = Math.min(self.patience, 30);
};
self.findNearestShelf = function () {
var nearestShelf = null;
var minDistance = Infinity;
var hasProductsAvailable = false;
shelves.forEach(function (shelf) {
if (shelf.products.length > 0) {
hasProductsAvailable = true;
var distance = Math.sqrt(Math.pow(self.x - shelf.x, 2) + Math.pow(self.y - shelf.y, 2));
if (distance < minDistance) {
minDistance = distance;
nearestShelf = shelf;
}
}
});
// If no products available, customer complains
if (!hasProductsAvailable && !self.hasComplained) {
self.hasComplained = true;
self.complain();
}
return nearestShelf;
};
self.update = function () {
self.patience--;
if (self.patience <= 0) {
self.state = 'leaving';
}
// Walking animation
self.walkCycle += 0.2;
if (self.state === 'browsing' || self.state === 'checkout') {
self.bodyParts.leftLeg.rotation = Math.sin(self.walkCycle) * 0.3;
self.bodyParts.rightLeg.rotation = Math.sin(self.walkCycle + Math.PI) * 0.3;
self.bodyParts.leftArm.rotation = Math.sin(self.walkCycle + Math.PI) * 0.2;
self.bodyParts.rightArm.rotation = Math.sin(self.walkCycle) * 0.2;
self.bodyParts.body.y = Math.sin(self.walkCycle * 2) * 1;
}
if (self.state === 'browsing') {
if (!self.targetShelf) {
self.targetShelf = self.findNearestShelf();
}
if (self.targetShelf) {
var dx = self.targetShelf.x - self.x;
var dy = self.targetShelf.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 60) {
self.state = 'shopping';
self.patience = 60;
// Stop walking animation
self.bodyParts.leftLeg.rotation = 0;
self.bodyParts.rightLeg.rotation = 0;
self.bodyParts.leftArm.rotation = 0;
self.bodyParts.rightArm.rotation = 0;
} else {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
} else {
// No shelves with products available, customer becomes impatient
if (!self.hasComplained) {
self.hasComplained = true;
self.complain();
}
self.state = 'leaving';
}
} else if (self.state === 'shopping') {
if (self.targetShelf && self.targetShelf.products.length > 0) {
// Add item to shopping cart instead of direct purchase
self.shoppingCart.push({
item: self.targetShelf.productType,
price: self.targetShelf.price
});
self.targetShelf.sellProduct();
// Move to checkout
self.state = 'checkout';
self.targetShelf = null;
} else {
self.state = 'browsing';
self.targetShelf = null;
}
} else if (self.state === 'checkout') {
// Move to cashier
var cashier = findNearestCashier();
if (cashier) {
var dx = cashier.x - self.x;
var dy = cashier.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 80) {
// Process purchase at cashier
var total = 0;
self.shoppingCart.forEach(function (item) {
total += item.price;
});
money += total;
cashier.processCustomer(self);
createMoneyEffect(cashier.x, cashier.y - 50, total);
updateUI();
LK.getSound('cashRegister').play();
self.state = 'leaving';
} else {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
} else {
self.state = 'leaving';
}
} else if (self.state === 'leaving') {
// Move towards exit door
var dx = 1800 - self.x;
var dy = 600 - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 20) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
} else {
// Customer reached exit, remove them
self.destroy();
customers.splice(customers.indexOf(self), 1);
}
}
};
return self;
});
var Door = Container.expand(function () {
var self = Container.call(this);
// Create door frame
var frame = self.addChild(LK.getAsset('doorFrame', {
anchorX: 0.5,
anchorY: 0.5
}));
// Create door
var door = self.addChild(LK.getAsset('entranceDoor', {
anchorX: 0.5,
anchorY: 0.5
}));
self.doorType = 'entrance'; // 'entrance' or 'exit'
self.isOpen = false;
self.openTimer = 0;
self.setDoorType = function (type) {
self.doorType = type;
if (type === 'exit') {
door.destroy();
door = self.addChild(LK.getAsset('exitDoor', {
anchorX: 0.5,
anchorY: 0.5
}));
}
};
self.openDoor = function () {
if (!self.isOpen) {
self.isOpen = true;
self.openTimer = 60; // Keep door open for 1 second
// Animate door opening
tween(door, {
scaleX: 0.3,
alpha: 0.7
}, {
duration: 300
});
}
};
self.closeDoor = function () {
if (self.isOpen) {
self.isOpen = false;
// Animate door closing
tween(door, {
scaleX: 1,
alpha: 1
}, {
duration: 300
});
}
};
self.update = function () {
if (self.isOpen) {
self.openTimer--;
if (self.openTimer <= 0) {
self.closeDoor();
}
}
// Check for nearby customers to open door
var nearbyCustomer = false;
customers.forEach(function (customer) {
var distance = Math.sqrt(Math.pow(customer.x - self.x, 2) + Math.pow(customer.y - self.y, 2));
if (distance < 100) {
nearbyCustomer = true;
}
});
if (nearbyCustomer && !self.isOpen) {
self.openDoor();
}
};
return self;
});
var MoneyEffect = Container.expand(function () {
var self = Container.call(this);
var moneyIcon = self.attachAsset('money', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocity = {
x: (Math.random() - 0.5) * 4,
y: -2 - Math.random() * 2
};
self.lifetime = 120; // 2 seconds at 60fps
self.age = 0;
self.update = function () {
self.age++;
// Move upward and slightly sideways
self.x += self.velocity.x;
self.y += self.velocity.y;
// Fade out over time
self.alpha = 1 - self.age / self.lifetime;
// Scale effect
var scale = 1 + self.age / self.lifetime * 0.5;
self.scaleX = scale;
self.scaleY = scale;
// Remove when lifetime expires
if (self.age >= self.lifetime) {
self.destroy();
var index = moneyEffects.indexOf(self);
if (index > -1) {
moneyEffects.splice(index, 1);
}
}
};
return self;
});
var Shelf = Container.expand(function () {
var self = Container.call(this);
var shelfGraphics = self.attachAsset('shelf', {
anchorX: 0.5,
anchorY: 0.5
});
self.products = [];
self.maxProducts = 5;
self.productType = 'basic';
self.price = 10;
self.addProduct = function () {
if (self.products.length < self.maxProducts) {
var product = self.addChild(LK.getAsset('product', {
anchorX: 0.5,
anchorY: 0.5
}));
product.x = (self.products.length - 2) * 20;
product.y = -25;
self.products.push(product);
}
};
self.sellProduct = function () {
if (self.products.length > 0) {
var product = self.products.pop();
product.destroy();
return self.price;
}
return 0;
};
self.down = function (x, y, obj) {
if (self.products.length > 0) {
var earnings = self.sellProduct();
money += earnings;
createMoneyEffect(self.x, self.y - 50, earnings);
updateUI();
LK.getSound('purchase').play();
// Visual feedback
LK.effects.flashObject(self, 0x00FF00, 300);
}
};
return self;
});
var StoreManager = Container.expand(function () {
var self = Container.call(this);
self.customerSpawnTimer = 0;
self.customerSpawnRate = 120; // spawn every 2 seconds at 60fps
self.spawnCustomer = function () {
if (customers.length < 8) {
var customer = new Customer();
customer.x = 250; // Near entrance door
customer.y = 600 + (Math.random() - 0.5) * 100;
customers.push(customer);
game.addChild(customer);
}
};
self.update = function () {
self.customerSpawnTimer++;
if (self.customerSpawnTimer >= self.customerSpawnRate) {
self.customerSpawnTimer = 0;
self.spawnCustomer();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var money = storage.money || 500;
var level = storage.level || 1;
var shelves = [];
var customers = [];
var cashiers = [];
var moneyEffects = [];
var storeSize = storage.storeSize || 1;
var emptyShelfPenaltyTimer = 0;
var warningText = null;
// Cheat code system
var cheatSequence = [];
var cheatCode = ['expand', 'stock', 'hire', 'expand', 'stock']; // Secret sequence
var cheatTimer = 0;
var cheatMaxTime = 300; // 5 seconds to complete sequence
function checkCheatCode() {
if (cheatSequence.length === cheatCode.length) {
var isMatch = true;
for (var i = 0; i < cheatCode.length; i++) {
if (cheatSequence[i] !== cheatCode[i]) {
isMatch = false;
break;
}
}
if (isMatch) {
// Activate cheat - give money and stock all shelves
money += 5000;
// Stock all shelves to maximum
shelves.forEach(function (shelf) {
while (shelf.products.length < shelf.maxProducts) {
shelf.addProduct();
}
});
// Visual feedback
LK.effects.flashScreen(0x00ff00, 1000);
// Create cheat message
var cheatText = new Text2('CHEAT ACTIVATED!', {
size: 100,
fill: 0x00ff00
});
cheatText.anchor.set(0.5, 0.5);
cheatText.x = 1024;
cheatText.y = 1366;
game.addChild(cheatText);
// Animate cheat message
tween(cheatText, {
scaleX: 1.5,
scaleY: 1.5,
alpha: 0
}, {
duration: 3000,
onComplete: function onComplete() {
cheatText.destroy();
}
});
updateUI();
}
// Reset sequence
cheatSequence = [];
cheatTimer = 0;
}
}
function addToCheatSequence(buttonType) {
cheatSequence.push(buttonType);
cheatTimer = cheatMaxTime;
if (cheatSequence.length > cheatCode.length) {
cheatSequence = [];
cheatTimer = 0;
}
checkCheatCode();
}
// Helper function to find nearest cashier
function findNearestCashier() {
if (cashiers.length === 0) return null;
var nearestCashier = cashiers[0];
var minDistance = Infinity;
cashiers.forEach(function (cashier) {
var distance = Math.sqrt(Math.pow(cashier.x, 2) + Math.pow(cashier.y, 2));
if (distance < minDistance && !cashier.isProcessing) {
minDistance = distance;
nearestCashier = cashier;
}
});
return nearestCashier;
}
// Helper function to check if all shelves are empty
function areAllShelvesEmpty() {
return shelves.every(function (shelf) {
return shelf.products.length === 0;
});
}
// Function to show warning message
function showWarningMessage() {
if (warningText) {
warningText.destroy();
}
warningText = new Text2('Please buy products!', {
size: 80,
fill: 0xff0000
});
warningText.anchor.set(0.5, 0.5);
warningText.x = 1024;
warningText.y = 1366;
game.addChild(warningText);
// Flash the warning text
LK.effects.flashObject(warningText, 0xffff00, 1000);
}
// Function to show penalty message
function showPenaltyMessage() {
if (warningText) {
warningText.destroy();
}
warningText = new Text2('Buy products -$2', {
size: 80,
fill: 0xff0000
});
warningText.anchor.set(0.5, 0.5);
warningText.x = 1024;
warningText.y = 1366;
game.addChild(warningText);
// Flash the penalty text
LK.effects.flashObject(warningText, 0xffff00, 1000);
// Create penalty indicator next to money display
var penaltyIndicator = new Text2('-$2', {
size: 60,
fill: 0xff0000
});
penaltyIndicator.anchor.set(0, 0);
penaltyIndicator.x = moneyText.x + 100;
penaltyIndicator.y = moneyText.y;
LK.gui.top.addChild(penaltyIndicator);
// Animate penalty indicator
tween(penaltyIndicator, {
y: penaltyIndicator.y - 30,
alpha: 0
}, {
duration: 2000,
onComplete: function onComplete() {
penaltyIndicator.destroy();
}
});
}
// Function to hide warning message
function hideWarningMessage() {
if (warningText) {
warningText.destroy();
warningText = null;
}
}
// Function to create money effect at position
function createMoneyEffect(x, y, amount) {
// Create multiple money icons based on amount
var numEffects = Math.min(Math.floor(amount / 10) + 1, 5);
for (var i = 0; i < numEffects; i++) {
var effect = new MoneyEffect();
effect.x = x + (Math.random() - 0.5) * 40;
effect.y = y + (Math.random() - 0.5) * 20;
// Add slight delay between effects
var delay = i * 100;
if (delay > 0) {
effect.alpha = 0;
tween(effect, {
alpha: 1
}, {
duration: 200,
delay: delay
});
}
moneyEffects.push(effect);
game.addChild(effect);
}
}
// UI Elements
var moneyText = new Text2('$' + money, {
size: 60,
fill: 0x000000
});
moneyText.anchor.set(0.5, 0);
LK.gui.top.addChild(moneyText);
var levelText = new Text2('Level ' + level, {
size: 40,
fill: 0x000000
});
levelText.anchor.set(0, 0);
levelText.x = 50;
levelText.y = 50;
LK.gui.topLeft.addChild(levelText);
// Store floor
var storeFloor = game.addChild(LK.getAsset('storeFloor', {
anchorX: 0.5,
anchorY: 0.5
}));
storeFloor.x = 1024;
storeFloor.y = 866;
// Initial shelves
function createShelf(x, y) {
var shelf = new Shelf();
shelf.x = x;
shelf.y = y;
// Stock with initial products
for (var i = 0; i < 3; i++) {
shelf.addProduct();
}
shelves.push(shelf);
game.addChild(shelf);
return shelf;
}
// Create entrance and exit doors
var entranceDoor = new Door();
entranceDoor.x = 200; // Far left edge of store
entranceDoor.y = 600; // Middle height
entranceDoor.setDoorType('entrance');
game.addChild(entranceDoor);
var exitDoor = new Door();
exitDoor.x = 1800; // Far right edge of store
exitDoor.y = 600; // Middle height
exitDoor.setDoorType('exit');
game.addChild(exitDoor);
// Create initial store layout
createShelf(600, 500);
createShelf(800, 500);
createShelf(1000, 500);
createShelf(600, 700);
createShelf(800, 700);
createShelf(1000, 700);
// Create initial cashier - positioned at front of store for easy customer access
var cashier = new Cashier();
cashier.x = 800; // Center horizontally in store
cashier.y = 400; // Front of store for easy access
cashiers.push(cashier);
game.addChild(cashier);
// Expand store button
var expandButton = game.addChild(LK.getAsset('expandButton', {
anchorX: 0.5,
anchorY: 0.5
}));
expandButton.x = 1024;
expandButton.y = 1800;
expandButton.scaleX = 1.3;
expandButton.scaleY = 1.3;
var expandText = new Text2('Expand\n$150', {
size: 30,
fill: 0xFFFFFF
});
expandText.anchor.set(0.5, 0.5);
expandButton.addChild(expandText);
expandButton.down = function (x, y, obj) {
// Add to cheat sequence
addToCheatSequence('expand');
if (money >= 150) {
money -= 150;
storeSize++;
// Find the rightmost shelf position
var rightmostX = 0;
shelves.forEach(function (shelf) {
if (shelf.x > rightmostX) {
rightmostX = shelf.x;
}
});
// Add new shelves next to existing ones
var newShelfX = rightmostX + 200; // 200 pixels spacing between shelves
createShelf(newShelfX, 500);
createShelf(newShelfX, 700);
updateUI();
LK.getSound('expand').play();
LK.effects.flashObject(expandButton, 0x00FF00, 500);
} else {
LK.effects.flashObject(expandButton, 0xFF0000, 500);
}
};
// Restock button
var stockButton = game.addChild(LK.getAsset('stockButton', {
anchorX: 0.5,
anchorY: 0.5
}));
stockButton.x = 1024;
stockButton.y = 1920;
stockButton.scaleX = 1.3;
stockButton.scaleY = 1.3;
var stockText = new Text2('Restock\n$100', {
size: 30,
fill: 0xFFFFFF
});
stockText.anchor.set(0.5, 0.5);
stockButton.addChild(stockText);
stockButton.down = function (x, y, obj) {
// Add to cheat sequence
addToCheatSequence('stock');
if (money >= 100) {
money -= 100;
// Restock all shelves
shelves.forEach(function (shelf) {
while (shelf.products.length < shelf.maxProducts) {
shelf.addProduct();
}
});
updateUI();
LK.getSound('purchase').play();
LK.effects.flashObject(stockButton, 0x00FF00, 500);
} else {
LK.effects.flashObject(stockButton, 0xFF0000, 500);
}
};
// Hire cashier button
var hireCashierButton = game.addChild(LK.getAsset('hireCashierButton', {
anchorX: 0.5,
anchorY: 0.5
}));
hireCashierButton.x = 1024;
hireCashierButton.y = 2040;
hireCashierButton.scaleX = 1.3;
hireCashierButton.scaleY = 1.3;
var hireCashierText = new Text2('Hire\nCashier\n$175', {
size: 26,
fill: 0xFFFFFF
});
hireCashierText.anchor.set(0.5, 0.5);
hireCashierButton.addChild(hireCashierText);
hireCashierButton.down = function (x, y, obj) {
// Add to cheat sequence
addToCheatSequence('hire');
if (money >= 175) {
money -= 175;
// Create new cashier
var newCashier = new Cashier();
// Position new cashier next to existing cashiers
var cashierX = 600 + cashiers.length * 200;
var cashierY = 400;
newCashier.x = cashierX;
newCashier.y = cashierY;
cashiers.push(newCashier);
game.addChild(newCashier);
updateUI();
LK.getSound('cashRegister').play();
LK.effects.flashObject(hireCashierButton, 0x00FF00, 500);
} else {
LK.effects.flashObject(hireCashierButton, 0xFF0000, 500);
}
};
// Store manager
var storeManager = new StoreManager();
game.addChild(storeManager);
function updateUI() {
moneyText.setText('$' + money);
// Level up system
if (money >= level * 1000) {
level++;
levelText.setText('Level ' + level);
LK.effects.flashScreen(0x00FF00, 1000);
}
// Save progress
storage.money = money;
storage.level = level;
storage.storeSize = storeSize;
}
// Game loop
game.update = function () {
// Update customers
for (var i = customers.length - 1; i >= 0; i--) {
var customer = customers[i];
if (customer.update) {
customer.update();
}
}
// Update cashiers
for (var i = 0; i < cashiers.length; i++) {
var cashier = cashiers[i];
if (cashier.update) {
cashier.update();
}
}
// Update store manager
if (storeManager.update) {
storeManager.update();
}
// Update doors
if (entranceDoor.update) {
entranceDoor.update();
}
if (exitDoor.update) {
exitDoor.update();
}
// Update money effects
for (var i = moneyEffects.length - 1; i >= 0; i--) {
var effect = moneyEffects[i];
if (effect.update) {
effect.update();
}
}
// Check for empty shelves penalty
if (areAllShelvesEmpty()) {
emptyShelfPenaltyTimer++;
// Show warning message
showWarningMessage();
// Apply penalty every 10 seconds (600 ticks at 60fps)
if (emptyShelfPenaltyTimer >= 600) {
money -= 2;
emptyShelfPenaltyTimer = 0;
updateUI();
// Show penalty message
showPenaltyMessage();
// Flash screen red for penalty
LK.effects.flashScreen(0xff0000, 500);
}
} else {
emptyShelfPenaltyTimer = 0;
hideWarningMessage();
}
// Check win condition
if (money >= 10000) {
LK.showYouWin();
}
// Update cheat timer
if (cheatTimer > 0) {
cheatTimer--;
if (cheatTimer <= 0) {
cheatSequence = [];
}
}
// Check lose condition (bankruptcy)
if (money < 0 && shelves.every(function (shelf) {
return shelf.products.length === 0;
})) {
LK.showGameOver();
}
};
// Initialize UI
updateUI(); ===================================================================
--- original.js
+++ change.js
@@ -467,8 +467,69 @@
var moneyEffects = [];
var storeSize = storage.storeSize || 1;
var emptyShelfPenaltyTimer = 0;
var warningText = null;
+// Cheat code system
+var cheatSequence = [];
+var cheatCode = ['expand', 'stock', 'hire', 'expand', 'stock']; // Secret sequence
+var cheatTimer = 0;
+var cheatMaxTime = 300; // 5 seconds to complete sequence
+function checkCheatCode() {
+ if (cheatSequence.length === cheatCode.length) {
+ var isMatch = true;
+ for (var i = 0; i < cheatCode.length; i++) {
+ if (cheatSequence[i] !== cheatCode[i]) {
+ isMatch = false;
+ break;
+ }
+ }
+ if (isMatch) {
+ // Activate cheat - give money and stock all shelves
+ money += 5000;
+ // Stock all shelves to maximum
+ shelves.forEach(function (shelf) {
+ while (shelf.products.length < shelf.maxProducts) {
+ shelf.addProduct();
+ }
+ });
+ // Visual feedback
+ LK.effects.flashScreen(0x00ff00, 1000);
+ // Create cheat message
+ var cheatText = new Text2('CHEAT ACTIVATED!', {
+ size: 100,
+ fill: 0x00ff00
+ });
+ cheatText.anchor.set(0.5, 0.5);
+ cheatText.x = 1024;
+ cheatText.y = 1366;
+ game.addChild(cheatText);
+ // Animate cheat message
+ tween(cheatText, {
+ scaleX: 1.5,
+ scaleY: 1.5,
+ alpha: 0
+ }, {
+ duration: 3000,
+ onComplete: function onComplete() {
+ cheatText.destroy();
+ }
+ });
+ updateUI();
+ }
+ // Reset sequence
+ cheatSequence = [];
+ cheatTimer = 0;
+ }
+}
+function addToCheatSequence(buttonType) {
+ cheatSequence.push(buttonType);
+ cheatTimer = cheatMaxTime;
+ if (cheatSequence.length > cheatCode.length) {
+ cheatSequence = [];
+ cheatTimer = 0;
+ }
+ checkCheatCode();
+}
// Helper function to find nearest cashier
function findNearestCashier() {
if (cashiers.length === 0) return null;
var nearestCashier = cashiers[0];
@@ -643,8 +704,10 @@
});
expandText.anchor.set(0.5, 0.5);
expandButton.addChild(expandText);
expandButton.down = function (x, y, obj) {
+ // Add to cheat sequence
+ addToCheatSequence('expand');
if (money >= 150) {
money -= 150;
storeSize++;
// Find the rightmost shelf position
@@ -680,8 +743,10 @@
});
stockText.anchor.set(0.5, 0.5);
stockButton.addChild(stockText);
stockButton.down = function (x, y, obj) {
+ // Add to cheat sequence
+ addToCheatSequence('stock');
if (money >= 100) {
money -= 100;
// Restock all shelves
shelves.forEach(function (shelf) {
@@ -711,8 +776,10 @@
});
hireCashierText.anchor.set(0.5, 0.5);
hireCashierButton.addChild(hireCashierText);
hireCashierButton.down = function (x, y, obj) {
+ // Add to cheat sequence
+ addToCheatSequence('hire');
if (money >= 175) {
money -= 175;
// Create new cashier
var newCashier = new Cashier();
@@ -802,8 +869,15 @@
// Check win condition
if (money >= 10000) {
LK.showYouWin();
}
+ // Update cheat timer
+ if (cheatTimer > 0) {
+ cheatTimer--;
+ if (cheatTimer <= 0) {
+ cheatSequence = [];
+ }
+ }
// Check lose condition (bankruptcy)
if (money < 0 && shelves.every(function (shelf) {
return shelf.products.length === 0;
})) {