Advertisement

Red Flicker down or right direction

Started by July 25, 2018 06:50 PM
10 comments, last by Zakwayda 6 years, 6 months ago

I'm not set up to easily run the project right now, but I took a look at the code. I noticed this in Player::Update():


m_currentTextureIndex += 4;
m_sprite.setTexture(TextureManager::GetTexture(m_textureIDs[m_currentTextureIndex]));

m_currentTextureIndex -= 4;
m_sprite.setTexture(TextureManager::GetTexture(m_textureIDs[m_currentTextureIndex]));

I would add checks there to make sure the value of m_currentTextureIndex is valid before you index into m_textureIDs. m_textureIDs appears to be a raw array, and unless you've changed it, TextureManager::GetTexture() doesn't return a value if the texture isn't found, so there seems to be some opportunity for erroneous behavior there.

That may or may not be the problem, but it's something I noticed.

This topic is closed to new replies.

Advertisement