Исправь ошибки в моём коде: #include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

using namespace sf;


float offsetX = 0, offsetY = 0;


const int H = 17;
const int W = 150;


String TileMap[H] = {/*MAP IS HERE*/};

class TileMap
{
public:
    TileMap(const Texture& tileSet)
    {
        tile.setTexture(tileSet);
    }

    void loadMap(const String* map)
    {
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (map[i][j] == 'P')
                {
                    tile.setTextureRect(IntRect(143 - 16 * 3, 112, 16, 16));
                }
                else if (map[i][j] == 'k')
                {
                    tile.setTextureRect(IntRect(143, 112, 16, 16));
                }
                else if (map[i][j] == 'c')
                {
                    tile.setTextureRect(IntRect(143 - 16, 112, 16, 16));
                }
                else if (map[i][j] == 't')
                {
                    tile.setTextureRect(IntRect(0, 47, 32, 95 - 47));
                }
                else if (map[i][j] == 'g')
                {
                    tile.setTextureRect(IntRect(0, 16 * 9 - 5, 3 * 16, 16 * 2 + 5));
                }
                else if (map[i][j] == 'G')
                {
                    tile.setTextureRect(IntRect(145, 222, 222 - 145, 255 - 222));
                }
                else if (map[i][j] == 'd')
                {
                    tile.setTextureRect(IntRect(0, 106, 74, 127 - 106));
                }
                else if (map[i][j] == 'w')
                {
                    tile.setTextureRect(IntRect(99, 224, 140 - 99, 255 - 224));
                }
                else if (map[i][j] == 'r')
                {
                    tile.setTextureRect(IntRect(143 - 32, 112, 16, 16));
                }
                else if (map[i][j] == ' ' || map[i][j] == '0')
                {
                    continue;
                }

                tile.setPosition(j * 16 - offsetX, i * 16 - offsetY);
                window.draw(tile);
            }
        }
    }
private:
    Sprite tile;
};


class Character
{
public:
    Character(const Texture& image, float x, float y)
        : dx(0.1), dy(0.1), currentFrame(0), onGround(true), life(true)
    {
        sprite.setTexture(image);
        rect = FloatRect(x, y, 16, 16);
    }

    void update(float time)
    {
        rect.left += dx * time;
        Collision(0);

        if (!onGround) dy = dy + 0.0005 * time;
        rect.top += dy * time;
        onGround = false;
        Collision(1);

        currentFrame += time * 0.005;
        if (currentFrame > 3) currentFrame -= 3;

        if (dx > 0)
        {
            sprite.setTextureRect(IntRect(112 + 31 * int(currentFrame), 144, 16, 16));
        }
        else if (dx < 0)
        {
            sprite.setTextureRect(IntRect(112 + 31 * int(currentFrame) + 16, 144, -16, 16));
        }

        sprite.setPosition(rect.left - offsetX, rect.top - offsetY);
        dx = 0;
    }

    void Collision(int num)
    {
        for (int i = rect.top / 16; i < (rect.top + rect.height) / 16; i++)
        {
            for (int j = rect.left / 16; j < (rect.left + rect.width) / 16; j++)
            {
                if ((TileMap[i][j] == 'P') ||
                    (TileMap[i][j] == 'k') ||
                    (TileMap[i][j] == '0') ||
                    (TileMap[i][j] == 'r') ||
                    (TileMap[i][j] == 't'))
                {
                    if (dy > 0 && num == 1)
                    {
                        rect.top = i * 16 - rect.height;
                        dy = 0;
                        onGround = true;
                    }
                    if (dy < 0 && num == 1)
                    {
                        rect.top = i * 16 + 16;
                        dy = 0;
                    }
                    if (dx > 0 && num == 0)
                    {
                        rect.left = j * 16 - rect.width;
                    }
                    if (dx < 0 && num == 0)
                    {
                        rect.left = j * 16 + 16;
                    }
                }

                if (TileMap[i][j] == 'c')
                {
                    // TileMap[i][j]=’ '; 
                }
            }
        }
    }

    Sprite& getSprite() { return sprite; }

    
private:
    float dx, dy;
    FloatRect rect;
    bool onGround;
    Sprite sprite;
    float currentFrame;
    bool life;
    
};

class Game
{
public:
    Game()
        : window(VideoMode(400, 250), "SFML works!")
    {
        tileSet.loadFromFile("Images/Mario_Tileset.png");
        mario.setTexture(tileSet);
        enemy.setTexture(tileSet);
    }

    void run()
    {
        while (window.isOpen())
        {
            float time = clock.getElapsedTime().asMicroseconds();
            clock.restart();

            time = time / 500;  // здесь регулируем скорость игры

            if (time > 20) time = 20;

            Event event;
            while (window.pollEvent(event))
            {
                if (event.type == Event::Closed)
                {
                    window.close();
                }
            }

            if (Keyboard::isKeyPressed(Keyboard::Left))
            {
                mario.dx = -0.1;
            }

            if (Keyboard::isKeyPressed(Keyboard::Right))
            {
                mario.dx = 0.1;
            }

            if (Keyboard::isKeyPressed(Keyboard::Up) && mario.onGround)
            {
                mario.dy = -0.27;
                mario.onGround = false;
                sound.play();
            }

            mario.update(time);
            enemy.update(time);

            if (mario.getSprite().getGlobalBounds().intersects(enemy.getSprite().getGlobalBounds()))
            {
                if (enemy.life)
                {
                    if (mario.dy > 0)
                    {
                        enemy.dx = 0;
                        mario.dy = -0.2;
                        enemy.life = false;
                    }
                    else
                    {
                        mario.getSprite().setColor(Color::Red);
                    }
                }
            }

            if (mario.rect.left > 200)
            {
                offsetX = mario.rect.left - 200; // смещение
            }

            window.clear(Color(107, 140, 255));

            tileMap.loadMap(TileMap);
            window.draw(mario.getSprite());
            window.draw(enemy.getSprite());

            window.display();
        }
    }

private:
    RenderWindow window;
    Texture tileSet;
    Clock clock;
    String tileMap;
    Character mario;
    Character enemy;
    SoundBuffer buffer;
    Sound sound;
};

int main()
{
    Game game;
    game.run();

    return 0;
}