PLEASE HELP ME IM IN DESPREATE NEED OF IT
I HAVE THIS TANK GAME BUT I WANT A SHEILD FEATURE AND A WAY TO AGG MORE UPGRADES PLEASE PLEASE HELP!
I HAVE THIS TANK GAME BUT I WANT A SHEILD FEATURE AND A WAY TO AGG MORE UPGRADES PLEASE PLEASE HELP!
con gusto te ayudare
Tank = { health = 100, shieldActive = false, shieldStrength = 50, shieldDuration = 5, shieldTimer = 0 }
function Tank:activateShield() self.shieldActive = true self.shieldTimer = self.shieldDuration end
function Tank:update(dt) if self.shieldActive then self.shieldTimer = self.shieldTimer - dt if self.shieldTimer <= 0 or self.shieldStrength <= 0 then self.shieldActive = false end end end
function Tank:takeDamage(damage) if self.shieldActive and self.shieldStrength > 0 then local absorbed = math.min(damage, self.shieldStrength) self.shieldStrength = self.shieldStrength - absorbed damage = damage - absorbed end self.health = self.health - damage end
este es para las mejoras
Upgrades = { speed = 0, armor = 0, fireRate = 0, shieldBoost = 0 }
function applyUpgrade(tank, upgradeType, value) if upgradeType == "speed" then tank.speed = (tank.speed or 100) + value elseif upgradeType == "armor" then tank.health = tank.health + value elseif upgradeType == "fireRate" then tank.fireRate = (tank.fireRate or 1) - value elseif upgradeType == "shieldBoost" then tank.shieldStrength = tank.shieldStrength + value end end
y el uso
-- Activar escudo Tank:activateShield()
-- Aplicar mejora de escudo applyUpgrade(Tank, "shieldBoost", 25)
-- En el update del juego Tank:update(dt)
-- Cuando recibe daƱo Tank:takeDamage(30)
espero que funcione si necesitas mas ayuda con gusto estare ahi
@anyerpinero bro! ya pareces ia XD
XD hola soy anyerpinerogpt