public void render(Screen screen) {
        int xTile = 0;
        int yTile = 27;
        int walkingSpeed = 4;
        int flipTop = (numSteps >> walkingSpeed) & 1;
        int flipBottom = (numSteps >> walkingSpeed) & 1;

        if (movingDir == 1) {
            xTile += 2;
        } else if (movingDir > 1) {
            xTile += 4 + ((numSteps >> walkingSpeed) & 1) * 2;
            flipTop = (movingDir - 1) % 2;
        }

        int modifier = 16 * scale;
        int xOffset = x - modifier / 2;
        int yOffset = y - modifier / 2 - 4;
        if (isSwimming) {
            yOffset += 4;
            if (tickCount % 60 < 15) {
            } else if (15 <= tickCount % 60 && tickCount % 60 < 30) {
                yOffset -= 1;
            } else if (30 <= tickCount % 60 && tickCount % 60 < 45) {
            } else {
                yOffset -= 1;
            }
            screen.render(xOffset, yOffset + 5, 0 + 26 * 32, 0x00, 1);
            screen.render(xOffset+16, yOffset + 5, 0 + 26 * 32, 0x01, 1);
        }
        screen.render(xOffset + (modifier * flipTop), yOffset, xTile + yTile * 32, flipTop, scale);
        screen.render(xOffset + modifier - (modifier * flipTop), yOffset, (xTile + 1) + yTile * 32, flipTop,
                scale);

        if (!isSwimming) {
            screen.render(xOffset + (modifier * flipBottom), yOffset + modifier, xTile + (yTile + 1) * 32,
                    flipBottom, scale);
            screen.render(xOffset + modifier - (modifier * flipBottom), yOffset + modifier, (xTile + 1) + (yTile + 1)
                    * 32, flipBottom, scale);
        }
    }