hi im currently making a game in C++ and SDL and i have collisions working and i was wondering if there was a way to not draw the bad guy when a collision is detected
my code for drawing is
Code:
for (int i=0; i<size; i++)
{
evil[i].draw(surf);
}
the method draw is
Code:
void Sprite::draw(SDL_Surface *surf)
{
SDL_Rect rect;
if(m_hasImage)
{
// if an image has been loaded then use that
rect.x = static_cast<int>(m_x);
rect.y = static_cast<int>(m_y);
rect.w = rect.h = 0;
SDL_BlitSurface(m_image, 0, surf, &rect);
}
else
{
// Otherwise just draw a red square
rect.x = static_cast<int>(m_x);
rect.y = static_cast<int>(m_y);
rect.w = m_w;
rect.h = m_h;
SDL_FillRect(surf, &rect, 0xff0000);
}
}
so basically, when a collison is detected., i was wondering if there was a way to not draw the guy other than just set his coordinates way off the screen (which is what i have now)