// Jason Brillante "Damdoshi"
// Hanged Bunny Studio 2014-2015
//
// Sewer Glue

#include		"Ingame.hpp"

void			hbs::Ingame::NewCar(void)
{
  Element		el;

  if (levels[level].car_frequency == 0)
    return ;
  el.people.setTexture(ressources[CAR]);
  if (rand() % 2)
    {
      el.x = -(int)ressources[CAR].getSize().x;
      el.speed = (rand() % levels[level].car_frequency) / 10.0 + 1;
      el.layer = FORE;
    }
  else
    {
      el.x = ressources[BACKGROUND].getSize().x + ressources[CAR].getSize().x;
      el.speed = -((rand() % levels[level].car_frequency) / 10.0 + 1);
      el.layer = BACK;
    }
  car.push_back(el);
}

