
#include "strela.h"

Strela1::Strela1() 
{
  SetZrychlenie(0.01);
  SetOtacanie(0.5);
  SetReload(2000);
  SetPrebijanie(0);
  SetObrazok(load_bitmap("gfx/torpedo.tga",NULL));
}

void Strela1::Nakresli()
{
  double alfa = 0.71111111*GetUhol();
  rotate_sprite(bitmap,GetObrazok(),(int) GetPx() - 10,(int) GetPy() - 5, itofix(320 - (int) alfa));                                  
 
if(GetSpeed()<=GetMax_speed()-GetZrychlenie())
  SetSpeed(GetSpeed()+GetZrychlenie());
}

Strela2::Strela2()
{
  SetReload(3000);
  SetPrebijanie(0);
}

void Strela2::Nakresli()
{
circlefill(bitmap,(int) GetPx(),(int) GetPy(),5,makecol((int) 128*(GetReload() - GetPrebijanie())/GetMax_health(),(int) 128*(GetReload() - GetPrebijanie())/GetMax_health(),(int) 255 - 127*(GetReload() - GetPrebijanie())/GetMax_health()));
SetSpeed(GetMax_speed()*(GetReload() - GetPrebijanie())/GetMax_health()/4); 
}

Strela3::Strela3() 
{
  SetZrychlenie(0.00);
  SetOtacanie(0.1);
  SetReload(2500);
  SetPrebijanie(0);
  SetObrazok(load_bitmap("gfx/torpedo.tga",NULL));
}

void Strela3::Nakresli()
{
  double alfa = 0.71111111*GetUhol();
  rotate_sprite(bitmap,GetObrazok(),(int) GetPx() - 10,(int) GetPy() - 5, itofix(320 - (int) alfa)); 
if(GetSpeed()<=GetMax_speed()-GetZrychlenie())
  SetSpeed(GetSpeed()+GetZrychlenie());
}

Strela4::Strela4() 
{
  SetZrychlenie(0.01);
  SetOtacanie(0.0);
  SetReload(500);
  SetPrebijanie(0);
  SetObrazok(load_bitmap("gfx/gulomet.tga",NULL));
}

void Strela4::Nakresli()
{
  double alfa = 0.71111111*GetUhol();
  rotate_sprite(bitmap,GetObrazok(),(int) GetPx() - 6,(int) GetPy() - 3, itofix(320 - (int) alfa)); 
if(GetSpeed()<=GetMax_speed()-GetZrychlenie())
  SetSpeed(GetSpeed()+GetZrychlenie());
}
