void GameEngine::UpdateSprites(bool** map, int x) { // Update the sprites in the sprite vector RECT rcOldSpritePos; SPRITEACTION saSpriteAction; vector::iterator siSprite; for (siSprite = m_vSprites.begin(); siSprite != m_vSprites.end(); siSprite++) { // Save the old sprite position in case we need to restore it rcOldSpritePos = (*siSprite)->GetPosition(); //sprite lara x'in modu eklenmeli bool top = map[(( rcOldSpritePos.right - x % 40) / 40)+3 ][(rcOldSpritePos.top )/ 40] || map[((rcOldSpritePos.left - x % 40) / 40) + 1][(rcOldSpritePos.top) / 40]; // works both ai and player characters bool bottom = map[((rcOldSpritePos.right - x % 40) / 40) +3][(rcOldSpritePos.bottom) / 40] || map[((rcOldSpritePos.left - x % 40) / 40) + 1][(rcOldSpritePos.bottom) / 40]; // works both ai and player characters bool right = map[(( rcOldSpritePos.right - x % 40) / 40)+3 ] [(((rcOldSpritePos.top + rcOldSpritePos.bottom) / 2)) / 40]; // for moving enemies bool left = map[(( rcOldSpritePos.left - x % 40) / 40)+3] [(((rcOldSpritePos.top + rcOldSpritePos.bottom) / 2)) / 40]; // does not work for player character // Update the sprite // Update the sprite saSpriteAction = (*siSprite)->Update(top, bottom, right, left); // Handle the SA_KILL sprite action if (saSpriteAction & SA_KILL) { delete (*siSprite); m_vSprites.erase(siSprite); siSprite--; continue; } // See if the sprite collided with any others if (CheckSpriteCollision(*siSprite)) // Restore the old sprite position (*siSprite)->SetPosition(rcOldSpritePos); } }