#include "bullet.h"

CBullet::~CBullet()
{
}

void CBullet::Update( int deltaT )
{
    m_X += m_XVel * ((deltaT)/1000.f);
    m_Y += m_YVel * ((deltaT)/1000.f);

    //if (m_X > 0 && newDest < (640 - m_Sprite->m_DestRect.w))


    if (m_Sprite != NULL)
    {
        if (m_Y < -m_Sprite->m_DestRect.h || m_Y > (480 + m_Sprite->m_DestRect.h))
            m_Alive = false;


        m_Sprite->m_X = m_X;
        m_Sprite->m_Y = m_Y;
        m_Sprite->Update( deltaT );
    }
}

void CBullet::Draw( SDL_Surface* screen )
{
    if (m_Sprite != NULL)
        m_Sprite->Draw( screen );
}
