#include "EntObstacle.h"
#include "GameLogic.h"


EntObstacle::EntObstacle()
{
    m_sprite = NULL;
    GetRandomPosition(m_vPosition);
    Init();
    //find a good place to put us
    SetType(C_TYPE_OBSTACLE);


}

EntObstacle::~EntObstacle()
{
    SAFE_DELETE(m_sprite);
}

bool EntObstacle::Init()
{
    //setup stuff
    m_sprite = new CL_Sprite("rock", GetApp()->GetResourceManager());
     return true; //success
}


void EntObstacle::OnMessage(Message &msg)
{

    switch(msg.msg)
    {
    case C_MESSAGE_START_DAY:

        m_bFadeAlphaTo = true;
        SetType(C_TYPE_UNKNOWN);
        GetGameLogic->GetMessageDispatcher()->SendMsg(C_MESSAGE_KILL_ENTITY, 2000, this);
   
        break;

    }
    Entity::OnMessage(msg);

}


void EntObstacle::Render()
{
    m_sprite->set_alpha(m_alpha);
    m_sprite->draw(m_vPosition.x, m_vPosition.y);
}


void EntObstacle::Update(float step)
{
    Entity::Update(step);
    
}
