A weapon is shooting a Zombie with a Bullet. The Collision method is in the Bullet Actor.
The Zombie has Hitpoints so that every time i hit the zombie gets less and less hitpoints and eventually the Zombie dies
can somebody give me method for that?
i tried something like this:
public FatZombie()
{
speed = 1;
Hitpoints = 0;
Damage = 0;
}
public void act()
{
// Add your action code here.
super.stopZombie();
super.ZombieMove();
die();
}
public void damage(int value)
{
Hitpoints = Hitpoints + value;
}
public void die()
{
if(Hitpoints==10)
{
LV1 world = new LV1();
world.removeObject(this);
}
}
and in the Bullet class
public int kill = 0;
public boolean killed = false;
public int v1= 0;
FatZombie z = new FatZombie();
public SniperBullet()
{
speed = 80;
Damage = 5;
}
public void act()
{
shootingspeed();
checkSniperBullet();
remove();
}
public void checkSniperBullet()
{
Weapon w = new Weapon();
LV1 main = (LV1) this.getWorld();
Actor bullet = this.getOneIntersectingObject(Zombie.class);
if(bullet != null )
{
z.damage(5);
kill++;
speed--;
if(kill==2)
{
setLocation(0,0);
killed = true;
}
}
}
thx

