Code edit (5 edits merged)
Please save this source code
User prompt
Lets go ahead and standardize all human image assets that start with human_ to dimensions 48x146
User prompt
Please fix the bug: 'ReferenceError: greyscaleFilter is not defined' in or related to this line: 'humanGraphics.filters = [greyscaleFilter]; // Reset to greyscale filter' Line Number: 618
User prompt
Please fix the bug: 'ReferenceError: greyscaleFilter is not defined' in or related to this line: 'humanGraphics.filters = [greyscaleFilter]; // Reset to greyscale filter' Line Number: 618
User prompt
Please fix the bug: 'filters is not defined' in or related to this line: 'var greyscaleFilter = new filters.ColorMatrixFilter();' Line Number: 487
Code edit (3 edits merged)
Please save this source code
User prompt
atm the humans are not spawning in greyscale. this is a reminder of how we did it for zombies: zombieGraphics.tint = 0x007e94; // Blue tint for the mask YOu can use grey for a grey mask
User prompt
fix
User prompt
instead of doing this so complicated, do it similarly to how we apply masks on zombies. Apply a grey mask over our humans the same way we color our zombie
User prompt
Please fix the bug: 'filters is not defined' in or related to this line: 'humanGraphics.filters = [new filters.ColorMatrixFilter()];' Line Number: 484
User prompt
humans are not loading in greyscale
User prompt
now to normalize humans even further, make sure they load in greyscale
User prompt
one of the humans appear as purple rectangle why is this
Code edit (2 edits merged)
Please save this source code
User prompt
normalize all the human images (Human_#) asset to dimension 80x220. iterate through all of them
User prompt
We need to redo the appearance for humans. When it loads the Human image assets it can choose randomly between Human_1 all the way to Human_16 (That's right any of the 16 human images at random) so list them out and make them random
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
it's still not working. please remove the admin tools for now
User prompt
it's still not working. make sure the admin tool is crafted properly so it works. make sure its in the correct section. it should proabbly be in var factory
User prompt
our admin tool doesn't work, when i click mishnu snacks don't increase. lets remove what we just did and instead make an admin tool to increase meat by 10 when clicking. meat on the backend, not the display text
User prompt
add an easy to remove function that increase "dog food" (the backend in our factory) as I click as an admin tool. Label thos lines //admin tool so they can be removed easily later
Code edit (1 edits merged)
Please save this source code
User prompt
please fix this
User prompt
Please fix the bug: 'Timeout.tick error: UpgradedZombie is not defined' in or related to this line: 'newZombie = new UpgradedZombie(); // Upgraded zombie for higher levels' Line Number: 955
===================================================================
--- original.js
+++ change.js
@@ -793,379 +793,341 @@
}
// Add event listener for click to trigger the increaseMeatOnClick function
game.down = function (x, y, obj) {
increaseMeatOnClick();
-};
-function upgradeStatsAtMilestone() {
- // Check if factory.level is a multiple of 5
- if (factory.level % 5 === 0) {
- console.log("Level ".concat(factory.level, " reached! Upgrading stats for humans and zombies."));
- currentLevelGroup = Math.floor(factory.level / 5); // Update current level group
- // Upgrade stats for humans
- humans.forEach(function (human) {
- human.speedX *= 1.1; // Increase speed by 10%
- human.speedY *= 1.1;
- human.harvestTime = (human.harvestTime || 3000) * 2; // Increase harvest time by 100%
+ // Booster spawning logic
+ var boosters = [];
+ function spawnBooster() {
+ var booster = new Booster();
+ boosters.push(booster);
+ game.addChild(booster);
+ }
+ // Integrate boosters with Mishnu Snax increase
+ var uiLayer = new Container();
+ uiLayer.zIndex = 10; // Ensure it's above the background and mask
+ game.addChild(uiLayer);
+ var factory = uiLayer.addChild(new Factory());
+ var originalIncreaseDogFood = factory.startProcessing;
+ factory.startProcessing = function () {
+ originalIncreaseDogFood.call(factory);
+ // Reduce booster spawn rate as levels increase
+ if (factory.level % Math.max(1, Math.floor(factory.level / 3)) === 0) {
+ spawnBooster(); // Spawn boosters less frequently as level increases
+ }
+ };
+ // Mishnu pickup logic
+ function checkBoosterPickup() {
+ boosters.forEach(function (booster) {
+ var dx = booster.x - mishnu.x;
+ var dy = booster.y - mishnu.y;
+ if (Math.sqrt(dx * dx + dy * dy) < 50) {
+ booster.pickUp();
+ boosters.splice(boosters.indexOf(booster), 1);
+ }
});
- // Upgrade stats for zombies
+ }
+ // Add to game update loop
+ var originalGameUpdate = game.update;
+ game.update = function () {
+ originalGameUpdate.call(this);
+ boosters.forEach(function (booster) {
+ booster.update();
+ });
+ checkBoosterPickup();
+ };
+ var globalHealthBar = new GlobalHealthBar(100, 100);
+ function spawnZombies(count, maxZombiesOnScreen) {
+ for (var i = 0; i < count; i++) {
+ if (zombies.length >= maxZombiesOnScreen) {
+ break;
+ }
+ var spawnEdge = Math.floor(Math.random() * 3); // 0: top, 1: left, 2: right
+ var spawnX, spawnY;
+ switch (spawnEdge) {
+ case 0:
+ spawnX = Math.random() * 2048;
+ spawnY = -50;
+ break;
+ case 1:
+ spawnX = -50;
+ spawnY = Math.random() * (2432 - 300);
+ break;
+ case 2:
+ spawnX = 2048 + 50;
+ spawnY = Math.random() * (2432 - 300);
+ break;
+ }
+ var newZombie;
+ newZombie = new Zombie(); // Use base zombie class
+ if (currentLevelGroup > 0) {
+ // Upgrade stats for higher levels
+ newZombie.speed *= 1.1 * currentLevelGroup; // Increase speed by 10% per level group
+ newZombie.harvestTime = (newZombie.harvestTime || 4000) * Math.pow(2, currentLevelGroup); // Increase harvest time exponentially
+ newZombie.zombieGraphics.tint = 0xff0000; // Red tint for upgraded zombies
+ }
+ newZombie.x = spawnX;
+ newZombie.y = spawnY;
+ zombies.push(newZombie);
+ game.addChild(newZombie);
+ }
+ }
+ // Initialize zombies
+ var zombies = [];
+ var zombieSpawnCooldown = 3000; // Time (ms) between zombie spawn attempts
+ var zombieSpawnElapsedTime = 0;
+ var maxZombiesOnScreen = 10;
+ // Update game loop to handle zombies
+ var originalGameUpdate = game.update;
+ game.update = function () {
+ originalGameUpdate.call(this);
+ // Update zombies
zombies.forEach(function (zombie) {
- zombie.speed *= 1.1; // Increase speed by 10%
- zombie.harvestTime = (zombie.harvestTime || 4000) * 2; // Increase harvest time by 100%
+ zombie.update();
});
- // Apply visual changes (tint) for differentiation
- applyLevelColors();
+ // Spawn zombies if needed
+ zombieSpawnElapsedTime += 16; // Assume 16ms per frame
+ if (zombieSpawnElapsedTime >= zombieSpawnCooldown && zombies.length < maxZombiesOnScreen) {
+ spawnZombies(1, maxZombiesOnScreen); // Spawn one zombie at a time
+ zombieSpawnElapsedTime = 0;
+ }
+ // Ensure zombie count does not exceed maximum
+ if (zombies.length > maxZombiesOnScreen) {
+ while (zombies.length > maxZombiesOnScreen) {
+ var zombieToRemove = zombies.pop();
+ game.removeChild(zombieToRemove);
+ }
+ }
+ };
+ var isMusicPlaying = {
+ 'Music_Level_1_4': false,
+ 'Music_Level_1_5': false
+ };
+ // Update factory text
+ function updateFactoryText() {
+ factoryText.setText("Level: " + factory.level + "\nMeat: " + factory.meat + "\nMishnu Snax: " + factory.dogFood + "\nNext level at: " + factory.nextLevelRequirement);
}
-}
-function applyLevelColors() {
- var levelGroup = Math.floor(factory.level / 5);
- // Pale colors for humans
- var humanColors = [0xFFE4E1, 0xFFFACD, 0xE0FFFF, 0xF0E68C, 0xFFDAB9]; // Light pink, pale yellow, light cyan, khaki, peach
- var newHumanColor = humanColors[levelGroup % humanColors.length];
- // Booster-like colors for zombies
- var zombieColors = [0x30a330, 0xd93838, 0x2f53b4, 0xe9d735, 0xb733b7]; // Match booster colors
- var newZombieColor = zombieColors[levelGroup % zombieColors.length];
- // Apply pale color to humans
- humans.forEach(function (human) {
- human.humanGraphics.tint = newHumanColor;
+ // Function to randomly select a sound from a list
+ ;
+ // Add a UI layer to ensure factory is rendered above the background and mask
+ var uiLayer = new Container();
+ uiLayer.zIndex = 10; // Ensure it's above the background and mask
+ game.addChild(uiLayer);
+ // Create and position the health bar at the top center of the viewport
+ var globalHealthBar = new GlobalHealthBar(5, 5); // Initialize with initial and max health of 5
+ globalHealthBar.x = 1820; // Center horizontally
+ globalHealthBar.y = 2560; // Position at the top center
+ // Add text label 'Health' above the global health bar
+ var healthLabel = new Text2('Health', {
+ size: 50,
+ fill: 0xFFFFFF
});
- // Apply booster-like color to zombies
- zombies.forEach(function (zombie) {
- zombie.zombieGraphics.tint = newZombieColor;
+ healthLabel.anchor.set(0.5, 1);
+ healthLabel.x = globalHealthBar.x;
+ healthLabel.y = globalHealthBar.y - 60; // Position above the health bar
+ uiLayer.addChild(healthLabel);
+ uiLayer.addChild(globalHealthBar); // Add to the UI layer to ensure visibility
+ // Add the factory to the UI layer
+ var factory = uiLayer.addChild(new Factory());
+ // Initialize factory text
+ var factoryText = new Text2('Meat: 0\nMishnu Snax: 0\nNext level at: ', {
+ size: 50,
+ fill: 0xFFFFFF,
+ align: 'left'
});
- console.log("Applied colors: Humans (".concat(newHumanColor, "), Zombies (").concat(newZombieColor, ")"));
-}
-// Booster spawning logic
-var boosters = [];
-function spawnBooster() {
- var booster = new Booster();
- boosters.push(booster);
- game.addChild(booster);
-}
-// Integrate boosters with Mishnu Snax increase
-var uiLayer = new Container();
-uiLayer.zIndex = 10; // Ensure it's above the background and mask
-game.addChild(uiLayer);
-var factory = uiLayer.addChild(new Factory());
-var originalIncreaseDogFood = factory.startProcessing;
-factory.startProcessing = function () {
- originalIncreaseDogFood.call(factory);
- // Reduce booster spawn rate as levels increase
- if (factory.level % Math.max(1, Math.floor(factory.level / 3)) === 0) {
- spawnBooster(); // Spawn boosters less frequently as level increases
- }
-};
-// Mishnu pickup logic
-function checkBoosterPickup() {
- boosters.forEach(function (booster) {
- var dx = booster.x - mishnu.x;
- var dy = booster.y - mishnu.y;
- if (Math.sqrt(dx * dx + dy * dy) < 50) {
- booster.pickUp();
- boosters.splice(boosters.indexOf(booster), 1);
- }
- });
-}
-// Add to game update loop
-var originalGameUpdate = game.update;
-game.update = function () {
- originalGameUpdate.call(this);
- boosters.forEach(function (booster) {
- booster.update();
- });
- checkBoosterPickup();
-};
-var globalHealthBar = new GlobalHealthBar(100, 100);
-function spawnZombies(count, maxZombiesOnScreen) {
- for (var i = 0; i < count; i++) {
- if (zombies.length >= maxZombiesOnScreen) {
- break;
- }
- var spawnEdge = Math.floor(Math.random() * 3); // 0: top, 1: left, 2: right
- var spawnX, spawnY;
- switch (spawnEdge) {
- case 0:
- spawnX = Math.random() * 2048;
- spawnY = -50;
+ factoryText.anchor.set(0, 1);
+ LK.gui.bottomLeft.addChild(factoryText);
+ var nextLevel = 100; // Placeholder for next level goal
+ // Function to randomly spawn a human at the edges of the viewport
+ function spawnHumans(count, maxHumansOnScreen) {
+ var hardCap = 100; // Maximum number of humans allowed
+ for (var i = 0; i < count; i++) {
+ if (humans.length >= maxHumansOnScreen || humans.length >= hardCap) {
break;
- case 1:
- spawnX = -50;
- spawnY = Math.random() * (2432 - 300);
- break;
- case 2:
- spawnX = 2048 + 50;
- spawnY = Math.random() * (2432 - 300);
- break;
+ }
+ // Randomly select a spawn edge (excluding the bottom)
+ var spawnEdge = Math.floor(Math.random() * 3); // 0: top, 1: left, 2: right
+ var spawnX, spawnY;
+ switch (spawnEdge) {
+ case 0:
+ // Top
+ spawnX = Math.random() * 2048;
+ spawnY = -50; // Just outside the top boundary
+ break;
+ case 1:
+ // Left
+ spawnX = -50; // Just outside the left boundary
+ spawnY = Math.random() * (2432 - 300); // Exclude bottom UI area
+ break;
+ case 2:
+ // Right
+ spawnX = 2048 + 50; // Just outside the right boundary
+ spawnY = Math.random() * (2432 - 300); // Exclude bottom UI area
+ break;
+ }
+ // Create a new human and add it to the game
+ var newHuman;
+ if (currentLevelGroup === 0) {
+ newHuman = new Human(); // Base human
+ } else {
+ newHuman = new UpgradedHuman(); // Upgraded human for higher levels
+ }
+ newHuman.x = spawnX;
+ newHuman.y = spawnY;
+ humans.push(newHuman);
+ game.addChild(newHuman);
}
- var newZombie;
- newZombie = new Zombie(); // Use base zombie class
- if (currentLevelGroup > 0) {
- // Upgrade stats for higher levels
- newZombie.speed *= 1.1 * currentLevelGroup; // Increase speed by 10% per level group
- newZombie.harvestTime = (newZombie.harvestTime || 4000) * Math.pow(2, currentLevelGroup); // Increase harvest time exponentially
- newZombie.zombieGraphics.tint = 0xff0000; // Red tint for upgraded zombies
- }
- newZombie.x = spawnX;
- newZombie.y = spawnY;
- zombies.push(newZombie);
- game.addChild(newZombie);
}
-}
-// Initialize zombies
-var zombies = [];
-var zombieSpawnCooldown = 3000; // Time (ms) between zombie spawn attempts
-var zombieSpawnElapsedTime = 0;
-var maxZombiesOnScreen = 10;
-// Update game loop to handle zombies
-var originalGameUpdate = game.update;
-game.update = function () {
- originalGameUpdate.call(this);
- // Update zombies
- zombies.forEach(function (zombie) {
- zombie.update();
- });
- // Spawn zombies if needed
- zombieSpawnElapsedTime += 16; // Assume 16ms per frame
- if (zombieSpawnElapsedTime >= zombieSpawnCooldown && zombies.length < maxZombiesOnScreen) {
- spawnZombies(1, maxZombiesOnScreen); // Spawn one zombie at a time
- zombieSpawnElapsedTime = 0;
- }
- // Ensure zombie count does not exceed maximum
- if (zombies.length > maxZombiesOnScreen) {
- while (zombies.length > maxZombiesOnScreen) {
- var zombieToRemove = zombies.pop();
- game.removeChild(zombieToRemove);
+ // Update game loop
+ var originalUpdate = game.update;
+ game.update = function () {
+ originalUpdate.call(this);
+ // Update factory
+ factory.update();
+ // Check for level progression
+ if (factory.dogFood >= nextLevel) {
+ // Handle level progression logic here
+ nextLevel += 100; // Example: increase next level goal
+ updateFactoryText();
}
+ };
+ function flashGreyMask(targets, duration, flashes) {
+ var flashInterval = duration / (flashes * 2); // Time for each flash on/off
+ var flashCount = 0;
+ var interval = LK.setInterval(function () {
+ if (flashCount >= flashes * 2) {
+ // End the flashing effect
+ targets.forEach(function (target) {
+ if (target && typeof target.tint !== 'undefined') {
+ target.tint = 0xFFFFFF;
+ }
+ }); // Reset tint
+ LK.clearInterval(interval);
+ } else {
+ var isOn = flashCount % 2 === 0; // Toggle between grey and normal
+ var tintColor = isOn ? 0x808080 : 0xFFFFFF; // Grey tint or original
+ targets.forEach(function (target) {
+ if (target && typeof target.tint !== 'undefined') {
+ target.tint = tintColor;
+ }
+ }); // Apply tint
+ flashCount++;
+ }
+ }, flashInterval);
}
-};
-var isMusicPlaying = {
- 'Music_Level_1_4': false,
- 'Music_Level_1_5': false
-};
-// Update factory text
-function updateFactoryText() {
- factoryText.setText("Level: " + factory.level + "\nMeat: " + factory.meat + "\nMishnu Snax: " + factory.dogFood + "\nNext level at: " + factory.nextLevelRequirement);
-}
-// Function to randomly select a sound from a list
-;
-// Add a UI layer to ensure factory is rendered above the background and mask
-var uiLayer = new Container();
-uiLayer.zIndex = 10; // Ensure it's above the background and mask
-game.addChild(uiLayer);
-// Create and position the health bar at the top center of the viewport
-var globalHealthBar = new GlobalHealthBar(5, 5); // Initialize with initial and max health of 5
-globalHealthBar.x = 1820; // Center horizontally
-globalHealthBar.y = 2560; // Position at the top center
-// Add text label 'Health' above the global health bar
-var healthLabel = new Text2('Health', {
- size: 50,
- fill: 0xFFFFFF
-});
-healthLabel.anchor.set(0.5, 1);
-healthLabel.x = globalHealthBar.x;
-healthLabel.y = globalHealthBar.y - 60; // Position above the health bar
-uiLayer.addChild(healthLabel);
-uiLayer.addChild(globalHealthBar); // Add to the UI layer to ensure visibility
-// Add the factory to the UI layer
-var factory = uiLayer.addChild(new Factory());
-// Initialize factory text
-var factoryText = new Text2('Meat: 0\nMishnu Snax: 0\nNext level at: ', {
- size: 50,
- fill: 0xFFFFFF,
- align: 'left'
-});
-factoryText.anchor.set(0, 1);
-LK.gui.bottomLeft.addChild(factoryText);
-var nextLevel = 100; // Placeholder for next level goal
-// Function to randomly spawn a human at the edges of the viewport
-function spawnHumans(count, maxHumansOnScreen) {
- var hardCap = 100; // Maximum number of humans allowed
- for (var i = 0; i < count; i++) {
- if (humans.length >= maxHumansOnScreen || humans.length >= hardCap) {
- break;
- }
- // Randomly select a spawn edge (excluding the bottom)
- var spawnEdge = Math.floor(Math.random() * 3); // 0: top, 1: left, 2: right
- var spawnX, spawnY;
- switch (spawnEdge) {
- case 0:
- // Top
- spawnX = Math.random() * 2048;
- spawnY = -50; // Just outside the top boundary
- break;
- case 1:
- // Left
- spawnX = -50; // Just outside the left boundary
- spawnY = Math.random() * (2432 - 300); // Exclude bottom UI area
- break;
- case 2:
- // Right
- spawnX = 2048 + 50; // Just outside the right boundary
- spawnY = Math.random() * (2432 - 300); // Exclude bottom UI area
- break;
- }
- // Create a new human and add it to the game
- var newHuman;
- if (currentLevelGroup === 0) {
- newHuman = new Human(); // Base human
- } else {
- newHuman = new UpgradedHuman(); // Upgraded human for higher levels
- }
- newHuman.x = spawnX;
- newHuman.y = spawnY;
- humans.push(newHuman);
- game.addChild(newHuman);
+ function getRandomSound(soundList) {
+ return LK.getSound(soundList[Math.floor(Math.random() * soundList.length)]);
}
-}
-// Update game loop
-var originalUpdate = game.update;
-game.update = function () {
- originalUpdate.call(this);
- // Update factory
- factory.update();
- // Check for level progression
- if (factory.dogFood >= nextLevel) {
- // Handle level progression logic here
- nextLevel += 100; // Example: increase next level goal
- updateFactoryText();
+ // Function to fade out a sound
+ function fadeOutSound(sound, duration) {
+ var initialVolume = sound.volume;
+ var fadeStep = initialVolume / (duration / 100);
+ var fadeInterval = LK.setInterval(function () {
+ if (sound.volume > 0) {
+ sound.volume = Math.max(0, sound.volume - fadeStep);
+ } else {
+ LK.clearInterval(fadeInterval);
+ sound.stop();
+ }
+ }, 100);
}
-};
-function flashGreyMask(targets, duration, flashes) {
- var flashInterval = duration / (flashes * 2); // Time for each flash on/off
- var flashCount = 0;
- var interval = LK.setInterval(function () {
- if (flashCount >= flashes * 2) {
- // End the flashing effect
- targets.forEach(function (target) {
- if (target && typeof target.tint !== 'undefined') {
- target.tint = 0xFFFFFF;
- }
- }); // Reset tint
- LK.clearInterval(interval);
- } else {
- var isOn = flashCount % 2 === 0; // Toggle between grey and normal
- var tintColor = isOn ? 0x808080 : 0xFFFFFF; // Grey tint or original
- targets.forEach(function (target) {
- if (target && typeof target.tint !== 'undefined') {
- target.tint = tintColor;
- }
- }); // Apply tint
- flashCount++;
- }
- }, flashInterval);
-}
-function getRandomSound(soundList) {
- return LK.getSound(soundList[Math.floor(Math.random() * soundList.length)]);
-}
-// Function to fade out a sound
-function fadeOutSound(sound, duration) {
- var initialVolume = sound.volume;
- var fadeStep = initialVolume / (duration / 100);
- var fadeInterval = LK.setInterval(function () {
- if (sound.volume > 0) {
- sound.volume = Math.max(0, sound.volume - fadeStep);
- } else {
- LK.clearInterval(fadeInterval);
- sound.stop();
- }
- }, 100);
-}
-var radius = game.addChild(new HarvestRadius());
-var mishnu = game.addChild(new Mishnu());
-mishnu.harvestSpeed = 1; // Initialize harvest speed
-mishnu.x = 2048 / 2;
-mishnu.y = 2432 - 200;
-radius.x = mishnu.x;
-radius.y = mishnu.y;
-// Initialize humans
-var humans = [];
-for (var i = 0; i < 50; i++) {
- var human = new Human();
- human.x = Math.random() * 2048;
- human.y = Math.random() * (2432 - 100);
- humans.push(human);
- game.addChild(human);
- var humansSpawnedThisLevel = 0; // Tracks how many humans have spawned in the current level
- var humanSpawnLimit = factory.nextLevelRequirement * 7; // Set minimum spawn limit to nextLevelRequirement * 7
- var currentLevelGroup = Math.floor(factory.level / 5); // Determine the current level group
-}
-var spawnCooldown = 20; // Reduced time (in ms) between spawn attempts for faster spawning
-var spawnElapsedTime = 0; // Tracks time elapsed since the last spawn attempt
-// Play looping Dog Panting sound
-LK.getSound('Dog_panting').play({
- loop: true
-});
-// Handle mouse movement
-game.move = function (x, y, obj) {
- mishnu.targetX = x;
- mishnu.targetY = y;
-};
-// Display cargo count
-var cargoText = new Text2('Cargo: 0 / 10', {
- size: 50,
- fill: 0xFFFFFF
-});
-cargoText.anchor.set(1, 1);
-LK.gui.bottomRight.addChild(cargoText);
-// Music alternation logic
-var currentMusic = 'Music_Level_1_5';
-game.update = function () {
- humans.forEach(function (human) {
- human.update();
+ var radius = game.addChild(new HarvestRadius());
+ var mishnu = game.addChild(new Mishnu());
+ mishnu.harvestSpeed = 1; // Initialize harvest speed
+ mishnu.x = 2048 / 2;
+ mishnu.y = 2432 - 200;
+ radius.x = mishnu.x;
+ radius.y = mishnu.y;
+ // Initialize humans
+ var humans = [];
+ for (var i = 0; i < 50; i++) {
+ var human = new Human();
+ human.x = Math.random() * 2048;
+ human.y = Math.random() * (2432 - 100);
+ humans.push(human);
+ game.addChild(human);
+ var humansSpawnedThisLevel = 0; // Tracks how many humans have spawned in the current level
+ var humanSpawnLimit = factory.nextLevelRequirement * 7; // Set minimum spawn limit to nextLevelRequirement * 7
+ var currentLevelGroup = Math.floor(factory.level / 5); // Determine the current level group
+ }
+ var spawnCooldown = 20; // Reduced time (in ms) between spawn attempts for faster spawning
+ var spawnElapsedTime = 0; // Tracks time elapsed since the last spawn attempt
+ // Play looping Dog Panting sound
+ LK.getSound('Dog_panting').play({
+ loop: true
});
- mishnu.update();
- zombies.forEach(function (zombie) {
- zombie.update();
+ // Handle mouse movement
+ game.move = function (x, y, obj) {
+ mishnu.targetX = x;
+ mishnu.targetY = y;
+ };
+ // Display cargo count
+ var cargoText = new Text2('Cargo: 0 / 10', {
+ size: 50,
+ fill: 0xFFFFFF
});
- radius.update();
- boosters.forEach(function (booster) {
- booster.update();
- });
- checkBoosterPickup();
- // Calculate dynamic minimum and maximum humans on screen
- var minHumansOnScreen = Math.max((factory.nextLevelRequirement - factory.dogFood) * 7, 20); // Ensure a minimum of 20
- var maxHumansOnScreen = Math.ceil(minHumansOnScreen * 1.5); // Scale max to 150% of min
- // Ensure minimum number of humans on screen
- if (humans.length < minHumansOnScreen) {
- spawnElapsedTime += 16; // Assume 16ms per frame
- if (spawnElapsedTime >= spawnCooldown) {
- spawnHumans(minHumansOnScreen - humans.length, maxHumansOnScreen); // Pass the maxHumansOnScreen value
- spawnElapsedTime = 0; // Reset spawn elapsed time
- }
- }
- // Cap the number of humans to maxHumansOnScreen
- if (humans.length > maxHumansOnScreen) {
- // Remove excess humans from the game
- while (humans.length > maxHumansOnScreen) {
- var humanToRemove = humans.pop();
- game.removeChild(humanToRemove);
- }
- }
- // Update cargo text
- var textColor = mishnu.humansHarvested > mishnu.cargoMax ? 0xFF0000 : 0xFFFFFF;
- if (cargoText.fill !== textColor) {
- LK.gui.bottomRight.removeChild(cargoText);
- cargoText = new Text2('Cargo: ' + mishnu.humansHarvested + ' / ' + mishnu.cargoMax, {
- size: 50,
- fill: textColor
+ cargoText.anchor.set(1, 1);
+ LK.gui.bottomRight.addChild(cargoText);
+ // Music alternation logic
+ var currentMusic = 'Music_Level_1_5';
+ game.update = function () {
+ humans.forEach(function (human) {
+ human.update();
});
- cargoText.anchor.set(1, 1);
- LK.gui.bottomRight.addChild(cargoText);
- } else {
- cargoText.setText('Cargo: ' + mishnu.humansHarvested + ' / ' + mishnu.cargoMax);
- }
- // Play Music_Level_1_4 in a loop
- if (!isMusicPlaying['Music_Level_1_4']) {
- LK.playMusic('Music_Level_1_4', {
- loop: true
+ mishnu.update();
+ zombies.forEach(function (zombie) {
+ zombie.update();
});
- isMusicPlaying['Music_Level_1_4'] = true; // Track music state
- }
- // Play Music_Level_1_5 in a loop
- if (!isMusicPlaying['Music_Level_1_5']) {
- LK.playMusic('Music_Level_1_5', {
- loop: true
+ radius.update();
+ boosters.forEach(function (booster) {
+ booster.update();
});
- isMusicPlaying['Music_Level_1_5'] = true; // Track music state
- }
- // Update factory
- factory.update();
+ checkBoosterPickup();
+ // Calculate dynamic minimum and maximum humans on screen
+ var minHumansOnScreen = Math.max((factory.nextLevelRequirement - factory.dogFood) * 7, 20); // Ensure a minimum of 20
+ var maxHumansOnScreen = Math.ceil(minHumansOnScreen * 1.5); // Scale max to 150% of min
+ // Ensure minimum number of humans on screen
+ if (humans.length < minHumansOnScreen) {
+ spawnElapsedTime += 16; // Assume 16ms per frame
+ if (spawnElapsedTime >= spawnCooldown) {
+ spawnHumans(minHumansOnScreen - humans.length, maxHumansOnScreen); // Pass the maxHumansOnScreen value
+ spawnElapsedTime = 0; // Reset spawn elapsed time
+ }
+ }
+ // Cap the number of humans to maxHumansOnScreen
+ if (humans.length > maxHumansOnScreen) {
+ // Remove excess humans from the game
+ while (humans.length > maxHumansOnScreen) {
+ var humanToRemove = humans.pop();
+ game.removeChild(humanToRemove);
+ }
+ }
+ // Update cargo text
+ var textColor = mishnu.humansHarvested > mishnu.cargoMax ? 0xFF0000 : 0xFFFFFF;
+ if (cargoText.fill !== textColor) {
+ LK.gui.bottomRight.removeChild(cargoText);
+ cargoText = new Text2('Cargo: ' + mishnu.humansHarvested + ' / ' + mishnu.cargoMax, {
+ size: 50,
+ fill: textColor
+ });
+ cargoText.anchor.set(1, 1);
+ LK.gui.bottomRight.addChild(cargoText);
+ } else {
+ cargoText.setText('Cargo: ' + mishnu.humansHarvested + ' / ' + mishnu.cargoMax);
+ }
+ // Play Music_Level_1_4 in a loop
+ if (!isMusicPlaying['Music_Level_1_4']) {
+ LK.playMusic('Music_Level_1_4', {
+ loop: true
+ });
+ isMusicPlaying['Music_Level_1_4'] = true; // Track music state
+ }
+ // Play Music_Level_1_5 in a loop
+ if (!isMusicPlaying['Music_Level_1_5']) {
+ LK.playMusic('Music_Level_1_5', {
+ loop: true
+ });
+ isMusicPlaying['Music_Level_1_5'] = true; // Track music state
+ }
+ // Update factory
+ factory.update();
+ };
};
\ No newline at end of file
blurry texture background 4k black and white
can of Dog Food. Game asset. 3d clipart. Blank background. High contrast. No shadows..
black capsule. Game asset. 3d clipart. Blank background. High contrast. No shadows..
woman in short shorts. mobile game art. pixel art. full body. front facing. Blank background. High contrast. No shadows.
laser beam cartoon game asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
bone. clipart. cartoon. Blank background. High contrast. No shadows..
Game Over. Red game letters, dripping. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Dog_panting
Sound effect
Agony_Yell_1
Sound effect
Music_Level_1_5
Music
Music_Level_1_4
Music
Agony_Yell_2
Sound effect
Agony_Yell_3
Sound effect
Agony_Yell_4
Sound effect
Agony_Yell_5
Sound effect
Agony_Yell_6
Sound effect
Agony_Yell_7
Sound effect
Dog_Crunch
Sound effect
Dog_Crunch_2
Sound effect
Dog_Crunch_3
Sound effect
Ding_1
Sound effect
Squish_1
Sound effect
Squish_2
Sound effect
Squish_4
Sound effect
Squish_3
Sound effect
Factory_Deposit
Sound effect
Factory_Operation
Sound effect
Level_Up
Sound effect
Bark
Sound effect
Hit
Sound effect
Agony_Yell_8
Sound effect
Agony_Yell_9
Sound effect
GiggleMan_1
Sound effect
GiggleMan_2
Sound effect
GiggleMan_3
Sound effect
GiggleMan_4
Sound effect
Booster_Sound
Sound effect
Can
Sound effect
woosh
Sound effect
Agony_Yell_10
Sound effect
Bark_2
Sound effect
Bark_3
Sound effect
laser
Sound effect
searing
Sound effect
laser_2
Sound effect
Laser_3
Sound effect
Laser_4
Sound effect
Boss_Hit
Sound effect
Boss_Hit_2
Sound effect
Boss_Hit_3
Sound effect
GiggleMan_5
Sound effect
GiggleMan_6
Sound effect
hip_hop_loop
Sound effect