Ok good think the errors weren't important!
I have 3 movement codes. One for player, one for enemy and one for bullets.
All of them are subclasses to Entity which controls the move functions.
void Player::move(){
if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)){
mCircleShape.move(mSpeed, 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)){
mCircleShape.move(-mSpeed, 0);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)){
mCircleShape.move(0, mSpeed);
}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)){
mCircleShape.move(0, -mSpeed);
}
}
void Enemy::move(entityVector &mEnteties){
sf::Time checkUpdateDir = updateDir.getElapsedTime();
if (checkUpdateDir.asMilliseconds() > 350){
for (entityVector::iterator i = mEnteties.begin(); i != mEnteties.end(); i++){
Entity* enteties = *i;
if (enteties->isPlayer()){
float x = enteties->getX() - getX();
float y = enteties->getY() - getY();
mXDir = x / sqrt(powf(x, 2) + powf(y, 2)) * mSpeed;
mYDir = y / sqrt(powf(x, 2) + powf(y, 2)) * mSpeed;
}
}
updateDir.restart();
}
mCircleShape.move(mXDir, mYDir);
}
void Bullet::move(){
mCircleShape.move(mXDir, mYDir);
}