User prompt
has un meno de cargando con una barra abajo que cuando cargue te lleve al menu de seleccion de niveleas ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
as que cuando el zombie minero llegue ala ultima casilla ya no se pueda meter bajo tierra y que empiece a caminar hacia la derecha
User prompt
as que cuando el minero llegue ala ultima casilla salga y coma alas plantas desde atrsa
User prompt
as que cuando el zombie minero este excabando bajo tierra no pueda ser atacado pero tampoco puede atacar y cuando llega al final se voltee y coma las plantas desde atras
User prompt
agrega casas y vallas abajo
User prompt
pon mas arbustos y as que los arbustos esten por encima de los zombies
User prompt
elimina la casa de crazy dave
User prompt
pon las plantas en horizontal y arriba del patio
User prompt
pero que la casa de crazy dave no este serca de las podadoras y pon las semillas arriba
User prompt
pon la casa de crazy dave ala izquierda y en medio
User prompt
as mas arbustos y que la casa de crazi dave sea mas grande y que este en medio del patio
User prompt
añade la casa de crazy dave ala izquierda y unos arbustos ala derecha cubriendo al zombie que aparecera
User prompt
pon el boton de la semilla de bipetidora mas arriba para que de vea bien
User prompt
as que la pala este cerca del botos reiniciar y añade al zombie del periodico ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
elimina al zombiedoctor
User prompt
as que el efecto ojo de pez de scracht se ponga en todos los zombies al comer ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
has que cuando el zombie muera caiga al piso y añade al zombie en carro ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
has que los soles desaparezcan 5 segundos despues y has un efecto en los lanzaguisantes al disparar al estilo del efecto ojo de pez de scratch ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
as que la pincho hierba sea ignorada por los zombies y que le haga daño alos zombies ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
cuando aparezcan los zombies aparezca primero 1
User prompt
que los zombies tarden en aparecer 25 segundos y que el boton de reiniciar esta ala derecha
User prompt
añade un boton de reiniciar el mapa y que el zombie minero excabe bajo tierra y que se coma las plantas desde atras y añade la bipetirora osea un lanzaguisantes que puede disparar adelante y atras ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
añade al zombie minero y la bipetidora y que cada 10 segundos aparezcan 4 zombies y que por cada oleada aparezcan 30 zombies ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
haz que cuando se seleccione una planta se ponga en tonos grises y añade al zombie zombictor y el caracubo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
añade a la repetidora y tripitidora ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Lawnmower = Container.expand(function () { var self = Container.call(this); var lawnmowerGraphics = self.attachAsset('lawnmower', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 0; // Starts stationary self.activated = false; self.update = function () { if (self.activated) { self.x += 12; // Move fast when activated if (self.x > 2200) { self.destroy(); } } }; return self; }); var Pea = Container.expand(function () { var self = Container.call(this); var peaGraphics = self.attachAsset('pea', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.damage = 20; self.update = function () { self.x += self.speed; if (self.x > 2200) { self.destroy(); } }; return self; }); var Plant = Container.expand(function (type) { var self = Container.call(this); self.type = type; self.health = 100; self.maxHealth = 100; self.shootCooldown = 0; self.sunTimer = 0; var plantGraphics; if (type === 'sunflower') { plantGraphics = self.attachAsset('sunflower', { anchorX: 0.5, anchorY: 0.5 }); self.sunGenerateRate = 300; // ticks between sun generation } else if (type === 'peashooter') { plantGraphics = self.attachAsset('peashooter', { anchorX: 0.5, anchorY: 0.5 }); self.shootRate = 90; // ticks between shots } else if (type === 'wallnut') { plantGraphics = self.attachAsset('wallnut', { anchorX: 0.5, anchorY: 0.5 }); self.health = 300; self.maxHealth = 300; } else if (type === 'potatomine') { plantGraphics = self.attachAsset('potatomine', { anchorX: 0.5, anchorY: 0.5 }); self.health = 50; self.maxHealth = 50; self.exploded = false; } else if (type === 'carnivorousplant') { plantGraphics = self.attachAsset('carnivorousplant', { anchorX: 0.5, anchorY: 0.5 }); self.health = 200; self.maxHealth = 200; self.attackCooldown = 0; self.attackRange = 100; } else if (type === 'doomshroom') { plantGraphics = self.attachAsset('doomshroom', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.maxHealth = 100; self.exploded = false; self.armingTime = 900; // 15 seconds to arm self.currentArmingTime = 0; } else if (type === 'repeater') { plantGraphics = self.attachAsset('repeater', { anchorX: 0.5, anchorY: 0.5 }); self.shootRate = 90; // Same as peashooter } else if (type === 'threepeater') { plantGraphics = self.attachAsset('threepeater', { anchorX: 0.5, anchorY: 0.5 }); self.shootRate = 120; // Slightly slower due to triple shot } self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.destroy(); return true; } return false; }; self.update = function () { if (self.type === 'sunflower') { self.sunTimer++; if (self.sunTimer >= self.sunGenerateRate) { self.sunTimer = 0; var newSun = new Sun(); newSun.x = self.x + Math.random() * 40 - 20; newSun.y = self.y + Math.random() * 40 - 20; game.addChild(newSun); suns.push(newSun); } } else if (self.type === 'peashooter') { self.shootCooldown++; if (self.shootCooldown >= self.shootRate) { // Check if there's a zombie in this row var myRow = Math.floor((self.y - 500) / 140); var hasZombieInRow = false; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var zombieRow = Math.floor((zombie.y - 500) / 140); if (zombieRow === myRow && zombie.x > self.x) { hasZombieInRow = true; break; } } if (hasZombieInRow) { self.shootCooldown = 0; var pea = new Pea(); pea.x = self.x + 60; pea.y = self.y; game.addChild(pea); peas.push(pea); LK.getSound('shoot').play(); } } } else if (self.type === 'repeater') { self.shootCooldown++; if (self.shootCooldown >= self.shootRate) { // Check if there's a zombie in this row var myRow = Math.floor((self.y - 500) / 140); var hasZombieInRow = false; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var zombieRow = Math.floor((zombie.y - 500) / 140); if (zombieRow === myRow && zombie.x > self.x) { hasZombieInRow = true; break; } } if (hasZombieInRow) { self.shootCooldown = 0; // Shoot two peas with slight delay var pea1 = new Pea(); pea1.x = self.x + 60; pea1.y = self.y; game.addChild(pea1); peas.push(pea1); // Second pea with slight delay LK.setTimeout(function () { var pea2 = new Pea(); pea2.x = self.x + 60; pea2.y = self.y; game.addChild(pea2); peas.push(pea2); }, 150); LK.getSound('shoot').play(); } } } else if (self.type === 'threepeater') { self.shootCooldown++; if (self.shootCooldown >= self.shootRate) { // Check if there's a zombie in any of the three rows (current, above, below) var myRow = Math.floor((self.y - 500) / 140); var hasZombieInAnyRow = false; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var zombieRow = Math.floor((zombie.y - 500) / 140); if ((zombieRow === myRow || zombieRow === myRow - 1 || zombieRow === myRow + 1) && zombie.x > self.x) { hasZombieInAnyRow = true; break; } } if (hasZombieInAnyRow) { self.shootCooldown = 0; // Shoot three peas - center, above, below var centerPea = new Pea(); centerPea.x = self.x + 60; centerPea.y = self.y; game.addChild(centerPea); peas.push(centerPea); // Above pea (if row exists) if (myRow > 0) { var abovePea = new Pea(); abovePea.x = self.x + 60; abovePea.y = self.y - 140; game.addChild(abovePea); peas.push(abovePea); } // Below pea (if row exists) if (myRow < gridRows - 1) { var belowPea = new Pea(); belowPea.x = self.x + 60; belowPea.y = self.y + 140; game.addChild(belowPea); peas.push(belowPea); } LK.getSound('shoot').play(); } } } else if (self.type === 'potatomine' && !self.exploded) { // Check for zombies stepping on the mine var myRow = Math.floor((self.y - 500) / 140); for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var zombieRow = Math.floor((zombie.y - 500) / 140); if (zombieRow === myRow && Math.abs(self.x - zombie.x) < 80) { // Explode! self.exploded = true; LK.getSound('explode').play(); // Create explosion visual effect tween(self, { scaleX: 3, scaleY: 3, alpha: 0 }, { duration: 500, easing: tween.easeOut, onFinish: function onFinish() { for (var k = plants.length - 1; k >= 0; k--) { if (plants[k] === self) { plants.splice(k, 1); self.destroy(); break; } } } }); LK.effects.flashObject(self, 0xFF4500, 500); // Damage all zombies in the area for (var j = zombies.length - 1; j >= 0; j--) { var targetZombie = zombies[j]; var distance = Math.sqrt(Math.pow(self.x - targetZombie.x, 2) + Math.pow(self.y - targetZombie.y, 2)); if (distance < 120) { if (targetZombie.takeDamage(200)) { targetZombie.destroy(); zombies.splice(j, 1); } } } break; } } } else if (self.type === 'carnivorousplant') { self.attackCooldown++; if (self.attackCooldown >= 180) { // Attack every 3 seconds var myRow = Math.floor((self.y - 500) / 140); var closestZombie = null; var closestDistance = Infinity; for (var i = 0; i < zombies.length; i++) { var zombie = zombies[i]; var zombieRow = Math.floor((zombie.y - 500) / 140); if (zombieRow === myRow) { var distance = Math.abs(self.x - zombie.x); if (distance < self.attackRange && distance < closestDistance) { closestDistance = distance; closestZombie = zombie; } } } if (closestZombie) { self.attackCooldown = 0; // Attack animation tween(self, { scaleX: 1.5, scaleY: 1.5 }, { duration: 200, easing: tween.easeOut, onFinish: function onFinish() { tween(self, { scaleX: 1, scaleY: 1 }, { duration: 200, easing: tween.easeIn }); } }); if (closestZombie.takeDamage(100)) { for (var j = zombies.length - 1; j >= 0; j--) { if (zombies[j] === closestZombie) { closestZombie.destroy(); zombies.splice(j, 1); break; } } } } } } else if (self.type === 'doomshroom' && !self.exploded) { self.currentArmingTime++; if (self.currentArmingTime >= self.armingTime) { // Doom shroom is now armed and explodes self.exploded = true; LK.getSound('explode').play(); // Create massive explosion visual effect tween(self, { scaleX: 8, scaleY: 8, alpha: 0 }, { duration: 1000, easing: tween.easeOut, onFinish: function onFinish() { for (var k = plants.length - 1; k >= 0; k--) { if (plants[k] === self) { plants.splice(k, 1); self.destroy(); break; } } } }); LK.effects.flashScreen(0x4B0082, 1000); // Damage all zombies on screen for (var j = zombies.length - 1; j >= 0; j--) { var targetZombie = zombies[j]; if (targetZombie.takeDamage(300)) { targetZombie.destroy(); zombies.splice(j, 1); } } } } }; return self; }); var Sun = Container.expand(function () { var self = Container.call(this); var sunGraphics = self.attachAsset('sun', { anchorX: 0.5, anchorY: 0.5 }); self.value = 25; self.collected = false; self.down = function (x, y, obj) { if (!self.collected) { self.collected = true; sunPoints += self.value; updateSunDisplay(); LK.getSound('collect').play(); self.destroy(); } }; return self; }); var Zombie = Container.expand(function (type) { var self = Container.call(this); self.type = type || 'normal'; self.health = 100; self.maxHealth = 100; self.speed = -1; self.attackDamage = 25; self.attackCooldown = 0; self.isAttacking = false; var zombieGraphics; if (self.type === 'fast') { zombieGraphics = self.attachAsset('fastZombie', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -2; self.health = 60; self.maxHealth = 60; } else if (self.type === 'doctor') { zombieGraphics = self.attachAsset('zombieDoctor', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -0.8; self.health = 150; self.maxHealth = 150; self.healCooldown = 0; } else if (self.type === 'snailBucket') { zombieGraphics = self.attachAsset('snailBucket', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -0.5; self.health = 250; self.maxHealth = 250; } else { zombieGraphics = self.attachAsset('zombie', { anchorX: 0.5, anchorY: 0.5 }); } self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { return true; } return false; }; self.update = function () { // Doctor zombie healing behavior if (self.type === 'doctor') { self.healCooldown++; if (self.healCooldown >= 300) { // Heal every 5 seconds self.healCooldown = 0; // Heal nearby zombies for (var k = 0; k < zombies.length; k++) { var nearbyZombie = zombies[k]; if (nearbyZombie !== self) { var distance = Math.sqrt(Math.pow(self.x - nearbyZombie.x, 2) + Math.pow(self.y - nearbyZombie.y, 2)); if (distance < 150) { nearbyZombie.health = Math.min(nearbyZombie.health + 30, nearbyZombie.maxHealth); tween(nearbyZombie, { tint: 0x00ff00 }, { duration: 300, easing: tween.easeOut, onFinish: function onFinish() { tween(nearbyZombie, { tint: 0xffffff }, { duration: 300, easing: tween.easeIn }); } }); } } } } } if (!self.isAttacking) { self.x += self.speed; // Check if zombie reached the left side if (self.x < 100) { gameOver(); return; } // Check for plants to attack var myRow = Math.floor((self.y - 500) / 140); for (var i = 0; i < plants.length; i++) { var plant = plants[i]; var plantRow = Math.floor((plant.y - 500) / 140); if (plantRow === myRow && Math.abs(self.x - plant.x) < 80) { self.isAttacking = true; break; } } } else { // Attack mode self.attackCooldown++; if (self.attackCooldown >= 60) { // Attack every second self.attackCooldown = 0; // Find plant to attack var myRow = Math.floor((self.y - 500) / 140); var targetPlant = null; for (var i = 0; i < plants.length; i++) { var plant = plants[i]; var plantRow = Math.floor((plant.y - 500) / 140); if (plantRow === myRow && Math.abs(self.x - plant.x) < 80) { targetPlant = plant; break; } } if (targetPlant) { if (targetPlant.takeDamage(self.attackDamage)) { // Plant destroyed, remove from array for (var j = plants.length - 1; j >= 0; j--) { if (plants[j] === targetPlant) { plants.splice(j, 1); break; } } self.isAttacking = false; } } else { self.isAttacking = false; } } } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228B22 }); /**** * Game Code ****/ // Game variables var sunPoints = 150; var currentWave = 1; var maxWaves = 5; var waveSpawnTimer = 0; var zombiesInWave = 0; var maxZombiesInWave = 5; var selectedPlantType = null; var shovelSelected = false; var gameState = 'playing'; // 'playing', 'won', 'lost' // Seed recharge system - 3 seconds = 180 ticks at 60 FPS var seedRechargeTime = 180; var seedCooldowns = { sunflower: 0, peashooter: 0, wallnut: 0, potatomine: 0, carnivorousplant: 0, doomshroom: 0, repeater: 0, threepeater: 0 }; // Game arrays var plants = []; var zombies = []; var peas = []; var suns = []; var lawnmowers = []; // Grid setup var gridStartX = 300; var gridStartY = 500; var gridCols = 12; var gridRows = 12; var cellSize = 140; // Plant costs var plantCosts = { sunflower: 50, peashooter: 100, wallnut: 50, potatomine: 25, carnivorousplant: 150, doomshroom: 125, repeater: 200, threepeater: 325 }; // UI Elements var sunDisplay = new Text2('Sun: ' + sunPoints, { size: 60, fill: 0xFFFF00 }); sunDisplay.anchor.set(0, 0); LK.gui.topLeft.addChild(sunDisplay); sunDisplay.x = 120; sunDisplay.y = 20; var waveDisplay = new Text2('Wave: ' + currentWave + '/' + maxWaves, { size: 50, fill: 0xFFFFFF }); waveDisplay.anchor.set(0.5, 0); LK.gui.top.addChild(waveDisplay); waveDisplay.y = 20; // Plant selection buttons with unique sprites var sunflowerButton = LK.getAsset('sunflower', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 400, scaleX: 0.8, scaleY: 0.8 }); game.addChild(sunflowerButton); var peashooterButton = LK.getAsset('peashooter', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 520, scaleX: 0.8, scaleY: 0.8 }); game.addChild(peashooterButton); var wallnutButton = LK.getAsset('wallnut', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 640, scaleX: 0.8, scaleY: 0.8 }); game.addChild(wallnutButton); var potatomineButton = LK.getAsset('potatomine', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 760, scaleX: 0.8, scaleY: 0.8 }); game.addChild(potatomineButton); var carnivorousplantButton = LK.getAsset('carnivorousplant', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 880, scaleX: 0.8, scaleY: 0.8 }); game.addChild(carnivorousplantButton); var doomshroomButton = LK.getAsset('doomshroom', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 1000, scaleX: 0.8, scaleY: 0.8 }); game.addChild(doomshroomButton); var repeaterButton = LK.getAsset('repeater', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 1120, scaleX: 0.8, scaleY: 0.8 }); game.addChild(repeaterButton); var threepeaterButton = LK.getAsset('threepeater', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 1240, scaleX: 0.8, scaleY: 0.8 }); game.addChild(threepeaterButton); var shovelButton = LK.getAsset('shovel', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 1360, scaleX: 0.8, scaleY: 0.8 }); game.addChild(shovelButton); // Plant cost labels var sunflowerCost = new Text2('50', { size: 30, fill: 0xFFFFFF }); sunflowerCost.anchor.set(0.5, 0.5); sunflowerCost.x = 100; sunflowerCost.y = 450; game.addChild(sunflowerCost); var peashooterCost = new Text2('100', { size: 30, fill: 0xFFFFFF }); peashooterCost.anchor.set(0.5, 0.5); peashooterCost.x = 100; peashooterCost.y = 570; game.addChild(peashooterCost); var wallnutCost = new Text2('50', { size: 30, fill: 0xFFFFFF }); wallnutCost.anchor.set(0.5, 0.5); wallnutCost.x = 100; wallnutCost.y = 690; game.addChild(wallnutCost); var potatomineeCost = new Text2('25', { size: 30, fill: 0xFFFFFF }); potatomineeCost.anchor.set(0.5, 0.5); potatomineeCost.x = 100; potatomineeCost.y = 810; game.addChild(potatomineeCost); var carnivorousplantCost = new Text2('150', { size: 30, fill: 0xFFFFFF }); carnivorousplantCost.anchor.set(0.5, 0.5); carnivorousplantCost.x = 100; carnivorousplantCost.y = 930; game.addChild(carnivorousplantCost); var doomshroomCost = new Text2('125', { size: 30, fill: 0xFFFFFF }); doomshroomCost.anchor.set(0.5, 0.5); doomshroomCost.x = 100; doomshroomCost.y = 1050; game.addChild(doomshroomCost); var repeaterCost = new Text2('200', { size: 30, fill: 0xFFFFFF }); repeaterCost.anchor.set(0.5, 0.5); repeaterCost.x = 100; repeaterCost.y = 1170; game.addChild(repeaterCost); var threepeaterCost = new Text2('325', { size: 30, fill: 0xFFFFFF }); threepeaterCost.anchor.set(0.5, 0.5); threepeaterCost.x = 100; threepeaterCost.y = 1290; game.addChild(threepeaterCost); // Draw grid for (var row = 0; row < gridRows; row++) { for (var col = 0; col < gridCols; col++) { var gridCell = LK.getAsset('gridCell', { anchorX: 0.5, anchorY: 0.5, x: gridStartX + col * cellSize, y: gridStartY + row * cellSize, alpha: 0.3 }); game.addChild(gridCell); } } // Initialize lawnmowers for (var row = 0; row < gridRows; row++) { var lawnmower = new Lawnmower(); lawnmower.x = 220; lawnmower.y = gridStartY + row * cellSize; game.addChild(lawnmower); lawnmowers.push(lawnmower); } function updateSunDisplay() { sunDisplay.setText('Sun: ' + sunPoints); } function canAffordPlant(plantType) { return sunPoints >= plantCosts[plantType]; } function isSeedReady(plantType) { return seedCooldowns[plantType] <= 0; } function canPlant(plantType) { return canAffordPlant(plantType) && isSeedReady(plantType); } function getGridPosition(x, y) { var col = Math.floor((x - gridStartX + cellSize / 2) / cellSize); var row = Math.floor((y - gridStartY + cellSize / 2) / cellSize); if (col >= 0 && col < gridCols && row >= 0 && row < gridRows) { return { row: row, col: col, x: gridStartX + col * cellSize, y: gridStartY + row * cellSize }; } return null; } function isGridOccupied(row, col) { for (var i = 0; i < plants.length; i++) { var plant = plants[i]; var plantRow = Math.floor((plant.y - gridStartY + cellSize / 2) / cellSize); var plantCol = Math.floor((plant.x - gridStartX + cellSize / 2) / cellSize); if (plantRow === row && plantCol === col) { return true; } } return false; } function spawnZombie() { var rand = Math.random(); var zombieType = 'normal'; if (rand < 0.2) { zombieType = 'fast'; } else if (rand < 0.35) { zombieType = 'doctor'; } else if (rand < 0.45) { zombieType = 'snailBucket'; } var zombie = new Zombie(zombieType); zombie.x = 2100; zombie.y = gridStartY + Math.floor(Math.random() * gridRows) * cellSize; game.addChild(zombie); zombies.push(zombie); } function gameOver() { if (gameState === 'playing') { gameState = 'lost'; LK.showGameOver(); } } function checkWinCondition() { if (currentWave > maxWaves && zombies.length === 0) { if (gameState === 'playing') { gameState = 'won'; LK.showYouWin(); } } } // Button event handlers sunflowerButton.down = function (x, y, obj) { if (canPlant('sunflower')) { selectedPlantType = 'sunflower'; shovelSelected = false; sunflowerButton.alpha = 1; sunflowerButton.tint = 0x808080; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; peashooterButton.down = function (x, y, obj) { if (canPlant('peashooter')) { selectedPlantType = 'peashooter'; shovelSelected = false; peashooterButton.alpha = 1; peashooterButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; wallnutButton.down = function (x, y, obj) { if (canPlant('wallnut')) { selectedPlantType = 'wallnut'; shovelSelected = false; wallnutButton.alpha = 1; wallnutButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; potatomineButton.down = function (x, y, obj) { if (canPlant('potatomine')) { selectedPlantType = 'potatomine'; shovelSelected = false; potatomineButton.alpha = 1; potatomineButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; carnivorousplantButton.down = function (x, y, obj) { if (canPlant('carnivorousplant')) { selectedPlantType = 'carnivorousplant'; shovelSelected = false; carnivorousplantButton.alpha = 1; carnivorousplantButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; doomshroomButton.down = function (x, y, obj) { if (canPlant('doomshroom')) { selectedPlantType = 'doomshroom'; shovelSelected = false; doomshroomButton.alpha = 1; doomshroomButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; repeaterButton.down = function (x, y, obj) { if (canPlant('repeater')) { selectedPlantType = 'repeater'; shovelSelected = false; repeaterButton.alpha = 1; repeaterButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; threepeaterButton.down = function (x, y, obj) { if (canPlant('threepeater')) { selectedPlantType = 'threepeater'; shovelSelected = false; threepeaterButton.alpha = 1; threepeaterButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } }; shovelButton.down = function (x, y, obj) { shovelSelected = true; selectedPlantType = null; shovelButton.alpha = 1; shovelButton.tint = 0x808080; sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; }; // Game event handlers game.down = function (x, y, obj) { if (shovelSelected) { // Remove plant functionality var gridPos = getGridPosition(x, y); if (gridPos) { for (var i = plants.length - 1; i >= 0; i--) { var plant = plants[i]; var plantRow = Math.floor((plant.y - gridStartY + cellSize / 2) / cellSize); var plantCol = Math.floor((plant.x - gridStartX + cellSize / 2) / cellSize); if (plantRow === gridPos.row && plantCol === gridPos.col) { plant.destroy(); plants.splice(i, 1); shovelSelected = false; // Reset button alphas and tints sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; break; } } } } else if (selectedPlantType && canPlant(selectedPlantType)) { var gridPos = getGridPosition(x, y); if (gridPos && !isGridOccupied(gridPos.row, gridPos.col)) { sunPoints -= plantCosts[selectedPlantType]; updateSunDisplay(); // Start seed recharge seedCooldowns[selectedPlantType] = seedRechargeTime; var newPlant = new Plant(selectedPlantType); newPlant.x = gridPos.x; newPlant.y = gridPos.y; game.addChild(newPlant); plants.push(newPlant); LK.getSound('plant').play(); selectedPlantType = null; // Reset button alphas and tints based on cooldown status sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; sunflowerButton.tint = 0xffffff; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; peashooterButton.tint = 0xffffff; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; wallnutButton.tint = 0xffffff; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; potatomineButton.tint = 0xffffff; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; carnivorousplantButton.tint = 0xffffff; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; doomshroomButton.tint = 0xffffff; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; repeaterButton.tint = 0xffffff; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; threepeaterButton.tint = 0xffffff; shovelButton.alpha = 1; shovelButton.tint = 0xffffff; } } }; // Main game update loop game.update = function () { if (gameState !== 'playing') return; // Wave management waveSpawnTimer++; if (currentWave <= maxWaves) { if (waveSpawnTimer >= 1800 && zombiesInWave < maxZombiesInWave) { // Spawn every 30 seconds spawnZombie(); zombiesInWave++; waveSpawnTimer = 0; } else if (zombiesInWave >= maxZombiesInWave && zombies.length === 0) { // Wave completed currentWave++; zombiesInWave = 0; maxZombiesInWave += 2; // Increase difficulty waveDisplay.setText('Wave: ' + currentWave + '/' + maxWaves); } } // Pea vs Zombie collision for (var i = peas.length - 1; i >= 0; i--) { var pea = peas[i]; var peaHit = false; for (var j = zombies.length - 1; j >= 0; j--) { var zombie = zombies[j]; if (Math.abs(pea.x - zombie.x) < 50 && Math.abs(pea.y - zombie.y) < 50) { if (zombie.takeDamage(pea.damage)) { zombie.destroy(); zombies.splice(j, 1); } pea.destroy(); peas.splice(i, 1); peaHit = true; break; } } if (!peaHit && pea.x > 2200) { pea.destroy(); peas.splice(i, 1); } } // Remove destroyed suns for (var k = suns.length - 1; k >= 0; k--) { if (suns[k].collected) { suns.splice(k, 1); } } // Update seed cooldowns for (var seedType in seedCooldowns) { if (seedCooldowns[seedType] > 0) { seedCooldowns[seedType]--; } } // Lawnmower activation - check if zombies reach the left side for (var m = zombies.length - 1; m >= 0; m--) { var zombie = zombies[m]; if (zombie.x < 250) { var zombieRow = Math.floor((zombie.y - gridStartY + cellSize / 2) / cellSize); if (zombieRow >= 0 && zombieRow < lawnmowers.length && !lawnmowers[zombieRow].activated) { lawnmowers[zombieRow].activated = true; // Remove zombie that triggered the lawnmower zombie.destroy(); zombies.splice(m, 1); } } } // Remove lawnmowers that are off screen for (var n = lawnmowers.length - 1; n >= 0; n--) { if (lawnmowers[n].x > 2200) { lawnmowers.splice(n, 1); } } // Lawnmower vs zombie collision for (var p = 0; p < lawnmowers.length; p++) { var lawnmower = lawnmowers[p]; if (lawnmower.activated) { for (var q = zombies.length - 1; q >= 0; q--) { var zombie = zombies[q]; if (Math.abs(lawnmower.x - zombie.x) < 60 && Math.abs(lawnmower.y - zombie.y) < 60) { zombie.destroy(); zombies.splice(q, 1); } } } } // Update button visual states based on cooldowns sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5; peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5; wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5; potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5; carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5; doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5; repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5; threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5; // Check win condition checkWinCondition(); };
===================================================================
--- original.js
+++ change.js
@@ -389,8 +389,25 @@
});
self.speed = -2;
self.health = 60;
self.maxHealth = 60;
+ } else if (self.type === 'doctor') {
+ zombieGraphics = self.attachAsset('zombieDoctor', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = -0.8;
+ self.health = 150;
+ self.maxHealth = 150;
+ self.healCooldown = 0;
+ } else if (self.type === 'snailBucket') {
+ zombieGraphics = self.attachAsset('snailBucket', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = -0.5;
+ self.health = 250;
+ self.maxHealth = 250;
} else {
zombieGraphics = self.attachAsset('zombie', {
anchorX: 0.5,
anchorY: 0.5
@@ -403,8 +420,40 @@
}
return false;
};
self.update = function () {
+ // Doctor zombie healing behavior
+ if (self.type === 'doctor') {
+ self.healCooldown++;
+ if (self.healCooldown >= 300) {
+ // Heal every 5 seconds
+ self.healCooldown = 0;
+ // Heal nearby zombies
+ for (var k = 0; k < zombies.length; k++) {
+ var nearbyZombie = zombies[k];
+ if (nearbyZombie !== self) {
+ var distance = Math.sqrt(Math.pow(self.x - nearbyZombie.x, 2) + Math.pow(self.y - nearbyZombie.y, 2));
+ if (distance < 150) {
+ nearbyZombie.health = Math.min(nearbyZombie.health + 30, nearbyZombie.maxHealth);
+ tween(nearbyZombie, {
+ tint: 0x00ff00
+ }, {
+ duration: 300,
+ easing: tween.easeOut,
+ onFinish: function onFinish() {
+ tween(nearbyZombie, {
+ tint: 0xffffff
+ }, {
+ duration: 300,
+ easing: tween.easeIn
+ });
+ }
+ });
+ }
+ }
+ }
+ }
+ }
if (!self.isAttacking) {
self.x += self.speed;
// Check if zombie reached the left side
if (self.x < 100) {
@@ -733,9 +782,18 @@
}
return false;
}
function spawnZombie() {
- var zombie = new Zombie(Math.random() < 0.3 ? 'fast' : 'normal');
+ var rand = Math.random();
+ var zombieType = 'normal';
+ if (rand < 0.2) {
+ zombieType = 'fast';
+ } else if (rand < 0.35) {
+ zombieType = 'doctor';
+ } else if (rand < 0.45) {
+ zombieType = 'snailBucket';
+ }
+ var zombie = new Zombie(zombieType);
zombie.x = 2100;
zombie.y = gridStartY + Math.floor(Math.random() * gridRows) * cellSize;
game.addChild(zombie);
zombies.push(zombie);
@@ -759,135 +817,216 @@
if (canPlant('sunflower')) {
selectedPlantType = 'sunflower';
shovelSelected = false;
sunflowerButton.alpha = 1;
+ sunflowerButton.tint = 0x808080;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
peashooterButton.down = function (x, y, obj) {
if (canPlant('peashooter')) {
selectedPlantType = 'peashooter';
shovelSelected = false;
peashooterButton.alpha = 1;
+ peashooterButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
wallnutButton.down = function (x, y, obj) {
if (canPlant('wallnut')) {
selectedPlantType = 'wallnut';
shovelSelected = false;
wallnutButton.alpha = 1;
+ wallnutButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
potatomineButton.down = function (x, y, obj) {
if (canPlant('potatomine')) {
selectedPlantType = 'potatomine';
shovelSelected = false;
potatomineButton.alpha = 1;
+ potatomineButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
carnivorousplantButton.down = function (x, y, obj) {
if (canPlant('carnivorousplant')) {
selectedPlantType = 'carnivorousplant';
shovelSelected = false;
carnivorousplantButton.alpha = 1;
+ carnivorousplantButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
doomshroomButton.down = function (x, y, obj) {
if (canPlant('doomshroom')) {
selectedPlantType = 'doomshroom';
shovelSelected = false;
doomshroomButton.alpha = 1;
+ doomshroomButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
repeaterButton.down = function (x, y, obj) {
if (canPlant('repeater')) {
selectedPlantType = 'repeater';
shovelSelected = false;
repeaterButton.alpha = 1;
+ repeaterButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
threepeaterButton.down = function (x, y, obj) {
if (canPlant('threepeater')) {
selectedPlantType = 'threepeater';
shovelSelected = false;
threepeaterButton.alpha = 1;
+ threepeaterButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
};
shovelButton.down = function (x, y, obj) {
shovelSelected = true;
selectedPlantType = null;
shovelButton.alpha = 1;
+ shovelButton.tint = 0x808080;
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
};
// Game event handlers
game.down = function (x, y, obj) {
if (shovelSelected) {
@@ -901,18 +1040,27 @@
if (plantRow === gridPos.row && plantCol === gridPos.col) {
plant.destroy();
plants.splice(i, 1);
shovelSelected = false;
- // Reset button alphas
+ // Reset button alphas and tints
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
break;
}
}
}
@@ -929,18 +1077,27 @@
game.addChild(newPlant);
plants.push(newPlant);
LK.getSound('plant').play();
selectedPlantType = null;
- // Reset button alphas based on cooldown status
+ // Reset button alphas and tints based on cooldown status
sunflowerButton.alpha = isSeedReady('sunflower') ? 1 : 0.5;
+ sunflowerButton.tint = 0xffffff;
peashooterButton.alpha = isSeedReady('peashooter') ? 1 : 0.5;
+ peashooterButton.tint = 0xffffff;
wallnutButton.alpha = isSeedReady('wallnut') ? 1 : 0.5;
+ wallnutButton.tint = 0xffffff;
potatomineButton.alpha = isSeedReady('potatomine') ? 1 : 0.5;
+ potatomineButton.tint = 0xffffff;
carnivorousplantButton.alpha = isSeedReady('carnivorousplant') ? 1 : 0.5;
+ carnivorousplantButton.tint = 0xffffff;
doomshroomButton.alpha = isSeedReady('doomshroom') ? 1 : 0.5;
+ doomshroomButton.tint = 0xffffff;
repeaterButton.alpha = isSeedReady('repeater') ? 1 : 0.5;
+ repeaterButton.tint = 0xffffff;
threepeaterButton.alpha = isSeedReady('threepeater') ? 1 : 0.5;
+ threepeaterButton.tint = 0xffffff;
shovelButton.alpha = 1;
+ shovelButton.tint = 0xffffff;
}
}
};
// Main game update loop
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Plant Defense: Zombie Wave" and with the description "Strategic tower defense game where players place plants to stop zombie waves from crossing their garden lawn.". No text on banner!
un lanzaguisantes. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
un girasol. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
un sol. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
guisante. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
La imagen muestra a una planta del videojuego "Plants vs. Zombies". Es una "Potato Mine" (Papa Mina), un tipo de planta explosiva. Características de la imagen: Forma: Tiene una forma redondeada y abultada, como la de una patata, que sobresale del suelo. Color: Es de color beige o marrón claro. Textura: Parece tener una superficie algo irregular, sugiriendo la textura de una patata o tierra. Cara: Posee dos ojos grandes y negros, de forma ovalada, y una pequeña boca sonriente con dos dientes frontales visibles. Esto le da una expresión amigable. Elemento superior: De la parte superior de la "patata" emerge un tallo gris delgado que sostiene una esfera roja brillante con un pequeño punto blanco en el centro. Esta esfera se asemeja al detonador de una mina o a una palanca de encendido. Base: Está rodeada por terrones de tierra o rocas pequeñas de color marrón oscuro, dando la impresión de que acaba de brotar del suelo o está parcialmente enterrada.. In-Game asset. 2d. High contrast. No shadows
Forma general: La planta tiene un cuerpo principal redondeado, similar a una cabeza, de donde emerge un tallo. Color: El cuerpo principal es de un vibrante color púrpura, salpicado con algunas manchas más oscuras del mismo tono. Boca: Posee una boca enorme y abierta que domina gran parte de su "cabeza". El borde de la boca es de un color verde lima brillante. Dientes: En el interior de la boca, se pueden ver numerosos dientes grandes, afilados y puntiagudos, de color blanco o crema, que sugieren su naturaleza carnívora. La encía visible dentro de la boca es de un tono rosa rojizo. Cuernos/Espinas: En la parte superior de su cabeza, tiene tres o cuatro protuberancias cónicas y afiladas, de color verde claro o blanquecino, que parecen espinas o cuernos. Tallo y hojas: Un tallo largo y curvado de color púrpura oscuro se extiende desde la parte inferior de la cabeza. Varias hojas verdes, con una forma ondulada o dentada, brotan del tallo, tanto cerca de la cabeza como en la base.. In-Game asset. 2d. High contrast. No shadows
Forma: Es una nuez grande y ovalada, con las dos mitades características de una nuez bien definidas y una hendidura central que las separa. Color: Predomina un color marrón dorado, típico de una nuez madura, con algunos matices más oscuros que sugieren textura y profundidad. Textura: La superficie parece rugosa y con imperfecciones, imitando la cáscara dura de una nuez real. Cara: A pesar de ser una nuez, tiene rasgos faciales humanoides en su parte frontal: Ojos: Dos ojos grandes, redondos y saltones con pupilas pequeñas y negras centradas. Los ojos tienen un borde blanco alrededor. Boca: Una pequeña línea horizontal que representa una boca sencilla y recta, dándole una expresión neutral o ligeramente sonriente, pero con una connotación de firmeza o determinación. Expresión: La combinación de los ojos grandes y la boca simple le otorgan una expresión de sorpresa o de estar alerta, lo que encaja con su función de muro defensivo. Fondo: El fondo es cuadriculado, lo que indica que. In-Game asset. 2d. High contrast. No shadows
un zombie de pvz. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
un zombie de pvz. In-Game asset. 2d. High contrast. No shadows
repetidora de pvz. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
una tripitidora de pvz 2 mirando a la derecha. In-Game asset. 2d. High contrast. No shadows
pala. In-Game asset. 2d. High contrast. No shadows
pincho roca pvz. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Forma general: Es una planta con un tallo central del que brotan hojas y, en la parte superior, tiene dos "cabezas" o vainas de guisante. Color: Predomina un color verde claro brillante en todo el cuerpo de la planta, con algunas sombras que le dan volumen y realismo. Las hojas y el tallo son de un verde ligeramente más oscuro. Cabezas/Vainas: Tiene dos vainas de guisante esféricas unidas, dispuestas una al lado de la otra. Cada una de ellas actúa como un cañón: Orificios de disparo: Ambas vainas tienen una abertura frontal redonda y oscura, que es por donde disparan los guisantes. Ojos: Cada vaina tiene dos pequeños ojos oscuros, similares a cuentas, que le dan una expresión curiosa o atenta. Hojas: En la base de las vainas y a lo largo del tallo, hay varias hojas grandes y ovaladas de color verde oscuro, con nervaduras visibles. Estilo artístico: La imagen tiene un estilo más renderizado y detallado que las ilustraciones típicas del juego, con un sombreado suave que le da una a. In-Game asset. 2d. High contrast. No shadows
lapida estilo PVZ. In-Game asset. 2d. High contrast. No shadows
podadora pvz. In-Game asset. 2d. High contrast. No shadows
El Zomboni es un zombi de tamaño considerable, vestido con un uniforme de trabajador y conduciendo un vehículo grande y robusto. La máquina suele ser de color azul o similar, con un rodillo en la parte trasera que es lo que esparce el hielo. Su aspecto es bastante imponente, señalando que no es un zombi común.. In-Game asset. 2d. High contrast. No shadows
petaseta de pvz en negro y gris con ojos rojos
arbustos grandes. In-Game asset. 2d. High contrast. No shadows
casilla de cesped en imagen completa con flores. In-Game asset. 2d. High contrast. No shadows
valla. In-Game asset. 2d. High contrast. No shadows
zombie minero pvz. In-Game asset. 2d. High contrast. No shadows
zombie leyendo un periodico con traje en cuerpo completo de pvz. In-Game asset. 2d. High contrast. No shadows
Uniforme Completo: Viste un uniforme de fútbol americano bastante completo, lo que le da una apariencia robusta y protegida. Casco de Fútbol: Lleva un casco de fútbol americano de color rojo brillante, adornado con dibujos de calaveras blancas y huesos cruzados, que son un distintivo de los zombis. Este casco no es solo estético, sino que le proporciona una defensa significativa en su cabeza. Hombreras y Camiseta: Tiene unas grandes hombreras blancas y una camiseta roja con el mismo patrón de calaveras y huesos en el pecho. Pantalones y Guantes: Sus pantalones son de color claro (crema o blanco roto) y lleva guantes rojos. Botas de Fútbol: Calza grandes botas de fútbol americano de color gris oscuro o negro. Boca Abierta y Cerebro: Típicamente, como muchos zombis, tiene la boca abierta, mostrando su deseo de cerebros. En tu imagen, parece tener algo verde (quizás una hoja o parte de una planta) sobresaliendo de su boca, lo que podría indicar que ya ha estado masticando algo.. In-Game asset. 2d. High contrast. No shadows
nenufar pvz. In-Game asset. 2d. High contrast. No shadows
Sombrero Púrpura: Tiene un sombrero grande y redondo de color púrpura oscuro o violeta, con manchas o puntos de un púrpura ligeramente más claro. Tallo Verde Claro: Su tallo es corto y robusto, de un color verde claro o menta. Ojos Grandes y Boquilla: Posee dos ojos grandes y redondos, y una "boca" o boquilla prominente en el frente, de color verde oscuro, desde donde expulsa sus proyectiles.. In-Game asset. 2d. High contrast. No shadows
Sombrero Anaranjado/Amarillo: Tiene un sombrero grande y redondo de color anaranjado o amarillo brillante, con manchas de un tono más oscuro o marrón-anaranjado. Los puntos grandes y luminosos en su sombrero le dan un aspecto amigable y sugieren su función solar. Tallo Beige/Crema: Su tallo es corto y regordete, de un color beige o crema claro. Cara Amigable: Posee dos ojos pequeños y redondos, y una pequeña sonrisa, dándole una expresión dulce y pasiva.. In-Game asset. 2d. High contrast. No shadows
Sombrero Iridiscente/Colorido: Su sombrero es la característica más llamativa, mostrando una gama de colores suaves y pastel que se mezclan como un arcoíris o un efecto iridiscente (rosas, azules, verdes claros, morados). Esto sugiere su naturaleza "hipnótica" o alucinógena. Tallo Púrpura Claro/Blanco: Su tallo es de un color púrpura muy claro o casi blanco. Ojos en Espiral/Hipnóticos: Sus "ojos" son dos grandes espirales rojas o rosadas, lo que claramente representa su capacidad de hipnotizar. Boca Triste/Somnolienta: Tiene una pequeña boca que parece un poco triste o somnolienta, lo que contrasta con la intensidad de sus ojos espirales.. In-Game asset. 2d. High contrast. No shadows
Cabeza (sombrero del hongo): Es grande, redonda y de color morado con manchas más oscuras. En el frente tiene una estructura que parece una boquilla o cañón, lo que da la impresión de que puede disparar algo. Cuerpo: Pequeño y de color verde claro, con una expresión facial seria o enojada. Tiene ojos grandes y cejas inclinadas hacia abajo, lo que resalta su actitud agresiva o decidida. Estilo: Es un diseño al estilo de caricatura o videojuego, similar a los personajes de Plants vs. Zombies.. In-Game asset. 2d. High contrast. No shadows
Cuerpo principal: Tiene forma de tronco cortado, de color gris oscuro con textura agrietada, lo que le da un aspecto envejecido o pétreo. La parte inferior tiene bordes irregulares que simulan raíces o madera desgastada. Ojos: Tiene dos ojos brillantes de color amarillo verdoso, con una expresión amenazante o intimidante. No tiene boca visible. Parte superior: Le crecen enredaderas verdes con hojas que sobresalen por arriba, dándole un toque vegetal y natural, como si la criatura estuviera conectada a la naturaleza o corrompida por ella. Estilo general: El diseño es oscuro y misterioso, probablemente representa a un enemigo o criatura poderosa en un juego tipo Plants vs. Zombies.. In-Game asset. 2d. High contrast. No shadows
Cristales de Hielo en la Parte Superior: Su característica más distintiva es la corona de cristales de hielo afilados y translúcidos de color azul brillante que cubren la parte superior de su cuerpo. Estos cristales le dan una apariencia gélida y punzante. Cuerpo Translúcido Azul/Turquesa: Su cuerpo principal es una masa translúcida de color azul claro o turquesa, que se asemeja al hielo o a un cuerpo gelatinoso congelado. Ojos Fruncidos y Fríos: Tiene dos ojos pequeños, oscuros y con las cejas fruncidas, lo que le da una expresión seria y gélida, a juego con su habilidad. Base Escarchada: La base de su cuerpo a menudo tiene un contorno escarchado o irregular, reforzando su temática de hielo.. In-Game asset. 2d. High contrast. No shadows
una lechuga. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
maseta mirando hacia arriba. In-Game asset. 2d. High contrast. No shadows
Cuerpo Robusto y Verde: El Zombot es una mole robótica de gran tamaño, con un cuerpo predominantemente de color verde oscuro, que le da un aspecto industrial y amenazante. Sus "hombros" y parte del torso están cubiertos por una armadura de color óxido o marrón rojizo, con remaches visibles. Cabeza de Zombi Grande: La cabeza del robot es grande y cuadrada, también de color verde, con mandíbulas inferiores prominentes que se abren para revelar dientes afilados. Tiene dos grandes ojos amarillos brillantes que emiten una luz siniestra, lo que lo hace parecer una versión robótica y gigantesca de un zombi común. Múltiples Mangueras y Cables: Varias mangueras o tuberías metálicas segmentadas sobresalen de sus hombros y otras partes del cuerpo, conectándose a sus brazos y cabeza, lo que sugiere un complejo sistema mecánico y de fluido. Brazos y Piernas Robóticas Grandes: Sus brazos son enormes y fornidos, con grandes manos que terminan en "dedos" gruesos y redondeados, capaces de infligir u. In-Game asset. 2d. High contrast. No shadows
Melón como Cuerpo: La planta en sí parece ser un melón grande y redondo, con las características rayas verdes oscuras y claras de una sandía. Cara y Hojas: Tiene dos ojos pequeños y una expresión que denota seriedad o concentración, propia de una planta de ataque. En su base, tiene hojas verdes que la asientan en el suelo. Brazos de Enredadera con Melón: De la parte superior de su cuerpo, salen dos enredaderas o tallos verdes y enrollados que sostienen un melón más pequeño. Este melón es el "proyectil" que lanza. El mecanismo sugiere que es una especie de honda o catapulta natural.. In-Game asset. 2d. High contrast. No shadows
casilla negra. In-Game asset. 2d. High contrast. No shadows
bola de cañon con fuego. In-Game asset. 2d. High contrast. No shadows
mantequilla. In-Game asset. 2d. High contrast. No shadows
grano de mais. In-Game asset. 2d. High contrast. No shadows
Un zombie grande ey fuerte eue sostiene un palo de electricidad. In-Game asset. 2d. High contrast. No shadows
Un botón de continuar al estilo lápida. In-Game asset. 2d. High contrast. No shadows
Tronco enojado con llamas arriba. In-Game asset. 2d. High contrast. No shadows