Thanks for the responses, but I unfortunately came to no solution. Here's the code cut down the best I could:
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>
#include <Windows.h>
using namespace std;
#include <time.h>
bool targethashit = false;
bool gunfire = false;
bool leftisclicked = false;
int main()
{
sf::RenderWindow window(sf::VideoMode(600, 600), "Window");
sf::RectangleShape hill1(sf::Vector2f(200, 200));
sf::RectangleShape hill2(sf::Vector2f(200, 400));
sf::RectangleShape hill3(sf::Vector2f(100, 500));
sf::RectangleShape hill4(sf::Vector2f(200, 100));
sf::RectangleShape sniper(sf::Vector2f(20, 40));
sf::RectangleShape snipergun(sf::Vector2f(50, 3));
sf::RectangleShape bullet(sf::Vector2f(15, 3));
sf::RectangleShape target1(sf::Vector2f(10, 10));
sf::RectangleShape si14(sf::Vector2f(20, 5)); //create the entity i need to rotate
bullet.setOrigin(-40, -375);
target1.setOrigin(-550, -296);
si14.setOrigin(-490, -375); //set the origin of the entity i need to rotate
si14.setFillColor(sf::Color::Green);
bullet.setFillColor(sf::Color::Yellow);
sniper.setOrigin(-30, -360);
snipergun.setOrigin(-40, -375);
hill1.setOrigin(0, -400);
hill2.setOrigin(-150, -300);
hill3.setOrigin(-350, -200);
hill4.setOrigin(-450, -500);
hill1.setFillColor(sf::Color::Green);
hill2.setFillColor(sf::Color::Green);
hill3.setFillColor(sf::Color::Green);
hill4.setFillColor(sf::Color::Green);
snipergun.setFillColor(sf::Color::Black);
sniper.setFillColor(sf::Color::Red);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear(sf::Color::Cyan);
window.draw(si14);
sf::FloatRect bulletb = bullet.getGlobalBounds();
sf::FloatRect target1b = target1.getGlobalBounds();
window.draw(snipergun);
window.draw(sniper);
window.draw(target1);
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
{
sniper.move(0.1, 0);
snipergun.move(0.1, 0);
bullet.move(0.1, 0);
}
si14.rotate(-0.1);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space))
{
sniper.move(0, -0.5);
snipergun.move(0, -0.5);
bullet.move(0, -0.5);
}
if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
si14.rotate(0.1); //it only rotates from the top left corner
}
window.display();
}
return 0;
}