#include "PickUp.h"

PickUp::PickUp()
{
     //ctor
}

PickUp::~PickUp()
{
     //dtor
}

void PickUp::init( b2World &world, float x, float y, float angle )
{
	// Images
	if ( m_imgCar == nullptr )
	{
          m_imgCar = SDL_LoadBMP("Textures/PickUp.bmp");
          SDL_SetColorKey( m_imgCar, SDL_SRCCOLORKEY, SDL_MapRGBA( m_imgCar->format, 0, 0, 0, 255 ) );
     }
     if ( m_imgWheel == nullptr )
     {
          m_imgWheel = SDL_LoadBMP("Textures/PickUpWheel.bmp");
          SDL_SetColorKey( m_imgWheel, SDL_SRCCOLORKEY, SDL_MapRGBA( m_imgWheel->format, 0, 0, 0, 255 ) );
     }

     // Propre !
     destroy( world );

     // Eléments
     createCarenage( world, x, y );

     b2Vec2 rel ;
     rel.Set( -0.3f, 0.25f );
     createMotorWheel( world, rel );

     rel.Set( 0.25f, 0.25f );
     createFreeWheel( world, rel );

     // Fin
     return ;
}