User prompt
Make it a 25% chance The cats die and turns red and disappears when getting flung from irongolemhelper. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where when a dog dies they turn red a disappear. Make it where when a cat dies they turn red a disappear. Make it where when a irongolemhelper dies they turn red a disappear. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where when attacking a cat,dog or irongolemhelper when each one dies the turn red and disappear. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where if he cat dies from fall damage they turn red in then disappear. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where there is a new 25%. Chance the cat dies from fall damage.
User prompt
Make the cats the got flung in the air stay in the air for 00.00.00.222 seconds. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where a irongolemhelper flings a cat into the air it flings them SOOOOOOOOO high. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where if a cat spawns to close to a irongolemhelper the irongolemhelper has a 5% chance of flinging the cat into the air and a 10% chance that cat dies from fall damage. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Delete the function of the dark ketchup splatting everywhere.
User prompt
Make it where the cats don’t go near the irongolemhelper
User prompt
Make it where if you hold down on the catbase it spawns a irongolemhelper.
User prompt
Make it where if the irongolemhelper gets too uncomfortable with too many cats around it flings the cat into the air and there is a 10% chance the cat will die from fall damage. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Remove the ketchup splatter everywhere
User prompt
Make it where if the irongolemhelper gets too uncomfortable with too many cats around and he kills some of them and make it where it splats dark ketchup everywhere if stays there till game restarts. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where when the ketchup goes everywhere it stays there till the game restarts.
User prompt
Make it where irongolemhelper instantly kills dogs but if a cat accidentally hits a irongolemhelper which is a 10% chance happening the irongolemhelper will kill the cat and dark ketchup goes everywhere. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where when a irongolemhelper touches a dog it kills them and it takes 5 hits to break dog base for irongolemhelper.
User prompt
Make irongolemhelper spawn when normalcat or cat base is low health. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the irongolemhelper bigger then catbase and dogbase ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the irongolemhelper bigger then normalcat ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make the irongolemhelper bigger then normalcat and takes two it’s to kill the dogs and the cat takes 2 hits to kill dog dogs take 3 hits to kill cats takes 23 hits and 10 dogs to kill a irongolemhelper. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Make it where the normal cats have a 20% chance too spawn a irongolemhelper it is more of a higher chance of spawning irongolemhelper if there low health.
User prompt
Make it where if you have money it never gets rid of it because it only goes away if you restart the game.
User prompt
Make it where if you already have 50¢ or more it doesn’t remove it when you spawn a cat or dog
User prompt
Make the coins way bigger ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Base = Container.expand(function (type) { var self = Container.call(this); self.type = type; // 'dog' or 'cat' self.health = 100; self.maxHealth = 100; self.isDestroyed = false; var baseGraphics = self.attachAsset(type === 'dog' ? 'dogBase' : 'catBase', { anchorX: 0.5, anchorY: 0.5 }); self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0 && !self.isDestroyed) { self.destroy(); } }; self.destroy = function () { self.isDestroyed = true; // Fade out animation tween(self, { alpha: 0 }, { duration: 1000, onFinish: function onFinish() { if (self.type === 'dog') { gameState = 'catsWin'; showMessage('Cats Win!'); } else { gameState = 'dogsWin'; showMessage('Dogs Win!'); } } }); }; return self; }); var Cat = Container.expand(function (isLambo) { var self = Container.call(this); self.isLambo = isLambo || false; self.health = 1; self.speed = self.isLambo ? 3 : 1.5; self.target = null; self.lastAttackTime = 0; self.lastMoveTime = 0; var catGraphics = self.attachAsset(self.isLambo ? 'lamboCat' : 'normalCat', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Lambo cats have movement cooldown if (self.isLambo && LK.ticks - self.lastMoveTime < 120) { return; } // Normal cats spawn irongolemhelper when at low health if (!self.isLambo && self.health <= 0.5) { // 20% base chance, higher when very low health var spawnChance = 0.2; if (self.health <= 0.2) { spawnChance = 0.6; // 60% chance when health is very low } else if (self.health <= 0.4) { spawnChance = 0.4; // 40% chance when health is low } if (Math.random() < spawnChance) { var irongolem = new IronGolemHelper(); irongolem.x = self.x + (Math.random() - 0.5) * 200; irongolem.y = self.y + (Math.random() - 0.5) * 200; ironGolems.push(irongolem); game.addChild(irongolem); } } // First check for nearby iron golems to avoid var avoidanceForceX = 0; var avoidanceForceY = 0; var avoidanceRadius = 150; // Distance to start avoiding iron golems for (var i = 0; i < ironGolems.length; i++) { var golem = ironGolems[i]; var dx = golem.x - self.x; var dy = golem.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); // If within avoidance radius, add avoidance force if (distance < avoidanceRadius && distance > 0) { var avoidanceStrength = (avoidanceRadius - distance) / avoidanceRadius; avoidanceForceX -= dx / distance * avoidanceStrength * 3; avoidanceForceY -= dy / distance * avoidanceStrength * 3; } } // Move towards nearest dog or dog base, but only if not avoiding iron golems var nearestTarget = null; var nearestDistance = Infinity; // Only look for dogs to attack, not iron golems for (var i = 0; i < dogs.length; i++) { var dog = dogs[i]; var dx = dog.x - self.x; var dy = dog.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestTarget = dog; } } var moveX = 0; var moveY = 0; if (nearestTarget) { // Move towards nearest dog var dx = nearestTarget.x - self.x; var dy = nearestTarget.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 5) { moveX = dx / distance * self.speed; moveY = dy / distance * self.speed; } // Attack if close enough if (distance < 50 && LK.ticks - self.lastAttackTime > 60) { self.attack(nearestTarget); self.lastAttackTime = LK.ticks; } } else if (dogBaseObj && !dogBaseObj.isDestroyed) { // Move towards dog base if no dogs present var dx = dogBaseObj.x - self.x; var dy = dogBaseObj.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 50) { moveX = dx / distance * self.speed; moveY = dy / distance * self.speed; } else if (LK.ticks - self.lastAttackTime > 60) { // Attack the base dogBaseObj.takeDamage(5); self.lastAttackTime = LK.ticks; LK.getSound('battle').play(); } } // Apply movement with avoidance force if (moveX !== 0 || moveY !== 0 || avoidanceForceX !== 0 || avoidanceForceY !== 0) { self.x += moveX + avoidanceForceX; self.y += moveY + avoidanceForceY; if (self.isLambo) { self.lastMoveTime = LK.ticks; } } }; self.attack = function (target) { if (target.takeDamageFromCat) { // Attacking an iron golem // 10% chance to accidentally hit the irongolemhelper if (Math.random() < 0.1) { // IronGolemHelper kills the cat and creates dark ketchup effect self.createDarkKetchupEffect(); target.killCat(self); return; } target.takeDamageFromCat(); } else { // Attacking a dog if (self.isLambo) { // Lambo cats can kill any dog self.killDog(target); } else { // Check for group attack on golden dogs if (target.isGolden) { var nearbyCats = self.countNearbyCats(); if (nearbyCats >= 9) { self.killDog(target); } } else { target.takeDamage(2); // Cats take 2 hits to kill dogs } } } LK.getSound('battle').play(); }; self.countNearbyCats = function () { var count = 0; for (var i = 0; i < cats.length; i++) { var cat = cats[i]; var dx = cat.x - self.x; var dy = cat.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 100) { count++; } } return count; }; self.killDog = function (dog) { var dogIndex = dogs.indexOf(dog); if (dogIndex > -1) { dogs.splice(dogIndex, 1); dog.destroy(); } }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.die(); } }; self.createDarkKetchupEffect = function () { // Create dark red splatter effect that stays permanently for (var i = 0; i < 8; i++) { var splatter = LK.getAsset('normalDog', { anchorX: 0.5, anchorY: 0.5, scaleX: 0.3, scaleY: 0.3 }); splatter.tint = 0x8B0000; // Dark red color for "dark ketchup" splatter.x = self.x + (Math.random() - 0.5) * 150; splatter.y = self.y + (Math.random() - 0.5) * 150; game.addChild(splatter); // Add to persistent ketchup array so it stays until game restart ketchupSplatters.push(splatter); // Brief animation without destroying the splatter tween(splatter, { scaleX: 0.5, scaleY: 0.5 }, { duration: 500 }); } }; self.die = function () { // Never lose money when cats die - keep it permanently moneyText.setText(playerMoney + '¢'); var catIndex = cats.indexOf(self); if (catIndex > -1) { cats.splice(catIndex, 1); } self.destroy(); }; return self; }); var Coin = Container.expand(function () { var self = Container.call(this); self.value = 50; var coinGraphics = self.attachAsset('coin', { anchorX: 0.5, anchorY: 0.5, scaleX: 6, scaleY: 6 }); self.down = function (x, y, obj) { // Collect coin based on its value var coinValue = self.value; if (self.value === 100) { // 100¢ coin has chance for extra 20¢ if (Math.random() < 0.2) { // 20% chance for extra coinValue += 20; } } playerMoney += coinValue; moneyText.setText(playerMoney + '¢'); var coinIndex = droppedCoins.indexOf(self); if (coinIndex > -1) { droppedCoins.splice(coinIndex, 1); } LK.getSound('coinCollect').play(); self.destroy(); }; return self; }); var Dog = Container.expand(function (isGolden) { var self = Container.call(this); self.isGolden = isGolden || false; self.health = 1; self.speed = 2; self.target = null; self.lastAttackTime = 0; var dogGraphics = self.attachAsset(self.isGolden ? 'goldenDog' : 'normalDog', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Move towards nearest cat, iron golem, or cat base var nearestTarget = null; var nearestDistance = Infinity; // Check cats for (var i = 0; i < cats.length; i++) { var cat = cats[i]; var dx = cat.x - self.x; var dy = cat.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestTarget = cat; } } // Check iron golems for (var i = 0; i < ironGolems.length; i++) { var golem = ironGolems[i]; var dx = golem.x - self.x; var dy = golem.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestTarget = golem; } } var nearestCat = nearestTarget; if (nearestCat) { // Move towards nearest cat var dx = nearestCat.x - self.x; var dy = nearestCat.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 5) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } // Attack if close enough if (distance < 50 && LK.ticks - self.lastAttackTime > 60) { self.attack(nearestCat); self.lastAttackTime = LK.ticks; } } else if (catBaseObj && !catBaseObj.isDestroyed) { // Move towards cat base if no cats present var dx = catBaseObj.x - self.x; var dy = catBaseObj.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 50) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } else if (LK.ticks - self.lastAttackTime > 60) { // Attack the base catBaseObj.takeDamage(5); self.lastAttackTime = LK.ticks; LK.getSound('battle').play(); } } }; self.attack = function (target) { if (target.takeDamageFromDog) { // Attacking an iron golem target.takeDamageFromDog(); } else { // Attacking a cat if (self.isGolden) { // Golden dogs instantly kill cats self.killCat(target); } else { // Dogs take 3 hits to kill cats target.takeDamage(3); } } LK.getSound('battle').play(); }; self.killCat = function (cat) { var catIndex = cats.indexOf(cat); if (catIndex > -1) { cats.splice(catIndex, 1); cat.destroy(); } }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.die(); } }; self.die = function () { // All dogs drop coins when they die self.dropCoins(); var dogIndex = dogs.indexOf(self); if (dogIndex > -1) { dogs.splice(dogIndex, 1); } self.destroy(); }; self.dropCoins = function () { // Drop single coin - 5% chance for 100¢ coin, otherwise 50¢ var coin = new Coin(); coin.x = self.x + (Math.random() - 0.5) * 100; coin.y = self.y + (Math.random() - 0.5) * 100; // 5% chance for 100¢ coin if (Math.random() < 0.05) { coin.value = 100; } else { coin.value = 50; } droppedCoins.push(coin); game.addChild(coin); }; return self; }); var IronGolemHelper = Container.expand(function () { var self = Container.call(this); self.health = 10; // Takes 23 hits from cats and 10 dogs to kill self.speed = 1; self.target = null; self.lastAttackTime = 0; self.hitsTakenFromCats = 0; self.hitsTakenFromDogs = 0; self.lastComfortCheck = 0; self.comfortThreshold = 5; // Gets uncomfortable with 5+ cats nearby var golemGraphics = self.attachAsset('Irongolemhelper', { anchorX: 0.5, anchorY: 0.5, scaleX: 4.0, scaleY: 4.0 }); self.update = function () { // Check comfort level every 60 ticks (1 second) if (LK.ticks - self.lastComfortCheck > 60) { self.checkComfortLevel(); self.lastComfortCheck = LK.ticks; } // Move towards nearest dog or dog base var nearestDog = null; var nearestDistance = Infinity; for (var i = 0; i < dogs.length; i++) { var dog = dogs[i]; var dx = dog.x - self.x; var dy = dog.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestDog = dog; } } if (nearestDog) { // Move towards nearest dog var dx = nearestDog.x - self.x; var dy = nearestDog.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 5) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } // Attack if close enough if (distance < 50 && LK.ticks - self.lastAttackTime > 60) { self.attack(nearestDog); self.lastAttackTime = LK.ticks; } } else if (dogBaseObj && !dogBaseObj.isDestroyed) { // Move towards dog base if no dogs present var dx = dogBaseObj.x - self.x; var dy = dogBaseObj.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 50) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } else if (LK.ticks - self.lastAttackTime > 60) { // Attack the base dogBaseObj.takeDamage(5); self.lastAttackTime = LK.ticks; LK.getSound('battle').play(); } } }; self.attack = function (dog) { // IronGolemHelper instantly kills dogs when touching them self.killDog(dog); LK.getSound('battle').play(); }; self.killDog = function (dog) { var dogIndex = dogs.indexOf(dog); if (dogIndex > -1) { dogs.splice(dogIndex, 1); dog.destroy(); } }; self.takeDamageFromCat = function () { self.hitsTakenFromCats++; if (self.hitsTakenFromCats >= 23) { self.die(); } }; self.takeDamageFromDog = function () { self.hitsTakenFromDogs++; if (self.hitsTakenFromDogs >= 10) { self.die(); } }; self.killCat = function (cat) { var catIndex = cats.indexOf(cat); if (catIndex > -1) { cats.splice(catIndex, 1); cat.destroy(); } }; self.checkComfortLevel = function () { // Count nearby cats within 200 pixel radius var nearbyCats = []; for (var i = 0; i < cats.length; i++) { var cat = cats[i]; var dx = cat.x - self.x; var dy = cat.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 200) { nearbyCats.push(cat); } } // If too many cats nearby, get uncomfortable and fling some if (nearbyCats.length >= self.comfortThreshold) { var catsToFling = Math.min(2, nearbyCats.length); // Fling up to 2 cats for (var j = 0; j < catsToFling; j++) { var victimCat = nearbyCats[j]; self.flingCat(victimCat); } } }; self.flingCat = function (cat) { // Store original position for fall back var originalY = cat.y; var flingHeight = -300; // Fling 300 pixels up var flingDirection = (Math.random() - 0.5) * 400; // Random horizontal fling // Fling cat up and sideways tween(cat, { x: cat.x + flingDirection, y: cat.y + flingHeight }, { duration: 800, easing: tween.easeOut, onFinish: function onFinish() { // Fall back down tween(cat, { y: originalY }, { duration: 600, easing: tween.easeIn, onFinish: function onFinish() { // 10% chance to die from fall damage if (Math.random() < 0.1) { cat.die(); } } }); } }); }; self.die = function () { var golemIndex = ironGolems.indexOf(self); if (golemIndex > -1) { ironGolems.splice(golemIndex, 1); } self.destroy(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228B22 }); /**** * Game Code ****/ var playerMoney = 50; var dogs = []; var cats = []; var droppedCoins = []; var ironGolems = []; var ketchupSplatters = []; // Persistent ketchup splatters // Remove all existing ketchup splatters for (var i = 0; i < ketchupSplatters.length; i++) { var splatter = ketchupSplatters[i]; if (splatter.parent) { splatter.parent.removeChild(splatter); } splatter.destroy(); } ketchupSplatters = []; var gameState = 'playing'; // 'playing', 'dogsWin', 'catsWin' var dogBaseObj = null; var catBaseObj = null; // Create piggy bank GUI var piggyBank = LK.getAsset('coin', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); LK.gui.topLeft.addChild(piggyBank); piggyBank.x = 80; piggyBank.y = 80; // Create money display next to piggy bank var moneyText = new Text2(playerMoney + '¢', { size: 60, fill: 0xFFFFFF }); moneyText.anchor.set(0, 0); LK.gui.topLeft.addChild(moneyText); moneyText.x = 120; // Offset from the left edge to avoid menu icon // Create message text for feedback var messageText = new Text2('', { size: 50, fill: 0xFF0000 }); messageText.anchor.set(0.5, 0); LK.gui.top.addChild(messageText); messageText.y = 100; var messageTimer = 0; function showMessage(text) { messageText.setText(text); messageTimer = 180; // Show for 3 seconds } // Create bases dogBaseObj = game.addChild(new Base('dog')); dogBaseObj.x = 400; dogBaseObj.y = 1366; catBaseObj = game.addChild(new Base('cat')); catBaseObj.x = 1648; catBaseObj.y = 1366; // Base click handlers dogBaseObj.down = function (x, y, obj) { if (gameState !== 'playing' || dogBaseObj.isDestroyed) return; if (playerMoney >= 50) { // Never deduct money - keep it permanently moneyText.setText(playerMoney + '¢'); // 5% chance for golden dog var isGolden = Math.random() < 0.05; var newDog = new Dog(isGolden); newDog.x = dogBaseObj.x + (Math.random() - 0.5) * 200; newDog.y = dogBaseObj.y - 100 + (Math.random() - 0.5) * 100; dogs.push(newDog); game.addChild(newDog); LK.getSound('spawn').play(); } }; // Track hold state for catBase var catBaseHoldStart = 0; var catBaseIsHolding = false; catBaseObj.down = function (x, y, obj) { if (gameState !== 'playing' || catBaseObj.isDestroyed) return; // Start tracking hold catBaseHoldStart = LK.ticks; catBaseIsHolding = true; }; catBaseObj.up = function (x, y, obj) { if (gameState !== 'playing' || catBaseObj.isDestroyed) return; var holdDuration = LK.ticks - catBaseHoldStart; catBaseIsHolding = false; // If held for more than 1 second (60 ticks), spawn irongolemhelper if (holdDuration >= 60) { var irongolem = new IronGolemHelper(); irongolem.x = catBaseObj.x + (Math.random() - 0.5) * 300; irongolem.y = catBaseObj.y - 150 + (Math.random() - 0.5) * 150; ironGolems.push(irongolem); game.addChild(irongolem); LK.getSound('spawn').play(); } else { // Short tap - spawn normal cat var newCat = new Cat(false); newCat.x = catBaseObj.x + (Math.random() - 0.5) * 200; newCat.y = catBaseObj.y - 100 + (Math.random() - 0.5) * 100; cats.push(newCat); game.addChild(newCat); // 20% chance to spawn irongolemhelper, higher chance if cat base has low health var spawnChance = 0.2; // Base 20% chance if (catBaseObj.health <= 30) { spawnChance = 0.6; // 60% chance when health is very low } else if (catBaseObj.health <= 60) { spawnChance = 0.4; // 40% chance when health is low } if (Math.random() < spawnChance) { var irongolem = new IronGolemHelper(); irongolem.x = catBaseObj.x + (Math.random() - 0.5) * 300; irongolem.y = catBaseObj.y - 150 + (Math.random() - 0.5) * 150; ironGolems.push(irongolem); game.addChild(irongolem); } LK.getSound('spawn').play(); } }; game.update = function () { // Update message timer if (messageTimer > 0) { messageTimer--; if (messageTimer <= 0) { messageText.setText(''); } } // Keep animals within bounds for (var i = 0; i < dogs.length; i++) { var dog = dogs[i]; if (dog.x < 0) dog.x = 0; if (dog.x > 2048) dog.x = 2048; if (dog.y < 0) dog.y = 0; if (dog.y > 2732) dog.y = 2732; } for (var i = 0; i < cats.length; i++) { var cat = cats[i]; if (cat.x < 0) cat.x = 0; if (cat.x > 2048) cat.x = 2048; if (cat.y < 0) cat.y = 0; if (cat.y > 2732) cat.y = 2732; } for (var i = 0; i < ironGolems.length; i++) { var golem = ironGolems[i]; if (golem.x < 0) golem.x = 0; if (golem.x > 2048) golem.x = 2048; if (golem.y < 0) golem.y = 0; if (golem.y > 2732) golem.y = 2732; } };
===================================================================
--- original.js
+++ change.js
@@ -75,12 +75,28 @@
ironGolems.push(irongolem);
game.addChild(irongolem);
}
}
- // Move towards nearest dog, iron golem, or dog base
+ // First check for nearby iron golems to avoid
+ var avoidanceForceX = 0;
+ var avoidanceForceY = 0;
+ var avoidanceRadius = 150; // Distance to start avoiding iron golems
+ for (var i = 0; i < ironGolems.length; i++) {
+ var golem = ironGolems[i];
+ var dx = golem.x - self.x;
+ var dy = golem.y - self.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ // If within avoidance radius, add avoidance force
+ if (distance < avoidanceRadius && distance > 0) {
+ var avoidanceStrength = (avoidanceRadius - distance) / avoidanceRadius;
+ avoidanceForceX -= dx / distance * avoidanceStrength * 3;
+ avoidanceForceY -= dy / distance * avoidanceStrength * 3;
+ }
+ }
+ // Move towards nearest dog or dog base, but only if not avoiding iron golems
var nearestTarget = null;
var nearestDistance = Infinity;
- // Check dogs
+ // Only look for dogs to attack, not iron golems
for (var i = 0; i < dogs.length; i++) {
var dog = dogs[i];
var dx = dog.x - self.x;
var dy = dog.y - self.y;
@@ -89,55 +105,47 @@
nearestDistance = distance;
nearestTarget = dog;
}
}
- // Check iron golems
- for (var i = 0; i < ironGolems.length; i++) {
- var golem = ironGolems[i];
- var dx = golem.x - self.x;
- var dy = golem.y - self.y;
- var distance = Math.sqrt(dx * dx + dy * dy);
- if (distance < nearestDistance) {
- nearestDistance = distance;
- nearestTarget = golem;
- }
- }
- var nearestDog = nearestTarget;
- if (nearestDog) {
+ var moveX = 0;
+ var moveY = 0;
+ if (nearestTarget) {
// Move towards nearest dog
- var dx = nearestDog.x - self.x;
- var dy = nearestDog.y - self.y;
+ var dx = nearestTarget.x - self.x;
+ var dy = nearestTarget.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
- self.x += dx / distance * self.speed;
- self.y += dy / distance * self.speed;
- if (self.isLambo) {
- self.lastMoveTime = LK.ticks;
- }
+ moveX = dx / distance * self.speed;
+ moveY = dy / distance * self.speed;
}
// Attack if close enough
if (distance < 50 && LK.ticks - self.lastAttackTime > 60) {
- self.attack(nearestDog);
+ self.attack(nearestTarget);
self.lastAttackTime = LK.ticks;
}
} else if (dogBaseObj && !dogBaseObj.isDestroyed) {
// Move towards dog base if no dogs present
var dx = dogBaseObj.x - self.x;
var dy = dogBaseObj.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 50) {
- self.x += dx / distance * self.speed;
- self.y += dy / distance * self.speed;
- if (self.isLambo) {
- self.lastMoveTime = LK.ticks;
- }
+ moveX = dx / distance * self.speed;
+ moveY = dy / distance * self.speed;
} else if (LK.ticks - self.lastAttackTime > 60) {
// Attack the base
dogBaseObj.takeDamage(5);
self.lastAttackTime = LK.ticks;
LK.getSound('battle').play();
}
}
+ // Apply movement with avoidance force
+ if (moveX !== 0 || moveY !== 0 || avoidanceForceX !== 0 || avoidanceForceY !== 0) {
+ self.x += moveX + avoidanceForceX;
+ self.y += moveY + avoidanceForceY;
+ if (self.isLambo) {
+ self.lastMoveTime = LK.ticks;
+ }
+ }
};
self.attack = function (target) {
if (target.takeDamageFromCat) {
// Attacking an iron golem
A white dog with black spots on him and one ear black and one ear blue. Make it a sitting dog with a heart grey hole in the middle of the body and make it SOOOO cute with big cute eyes with shines in them and make the dog facing right. Kinda 3d. Some Shadows.
A golden shining coin with the words “dogs vs cats coin” at the top and the coin says “50¢” . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Minecraft iron golem facing left with a pink flower on his forehead. Full body. 2d. Cool.
Golden dog with blue eyes that is SOO BUFF that he looks so cool and he scares everyone away. full body. Facing right. 2d.
Make a green health bar with words under it golden shiny letters saying “Superstronggoldendogform” and golden words on top saying “399HP”. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
A golden shining coin with the words “dogs vs cats coin” at the top and the coin says “100¢” . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Brown dog with a blue top hat. 🎩. In-Game asset. High contrast. No shadows. 2d.
Super buff Golden dog with a hand up laying falling in lava holding his hand out for help. full body. Facing right. 2d.
Make a white dog SOOOOOO CUTE. In-Game asset. 2d. High contrast. No shadows
A golden shining coin with the words “dogs vs cats coin” at the top and the coin says “1¢” . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
No background Minecraft iron ingot
Dirt square
Line of grass. In-Game asset. 2d. High contrast. No shadows
Cloud. In-Game asset. 2d. High contrast. No shadows
A golden shining coin with the words “dogs vs cats coin” at the top and the coin says “3000¢” with a dark yellow line under. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
A super buff iron golem with super big muscles and that has a Minecraft iron sword in his hand.. In-Game asset. 2d. High contrast. No shadows