I need help with a code so that when a character picks up a coin it has a stund effect on enemies specifically zombies I would really like help
public int stunTimer = 0;
public void act()
{
if (stunTimer > 0 && --stunTimer > 0) return;
// current code in act method here
}for (Object obj : getWorld().getObjects(Zombie.class))
{
((Zombie)obj).stunTimer = 300; // 5-seconds of stun time (approx. 60 acts per second)
}