using namespace std;
I really can't say more than what has already been said.
http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practiceUse of magic constants
From
projectile.hint direction = 0; // 1 - up, 2 - down, 3 - left, 4 - right
(should be using an enum here)
From
player.hint movementSpeed = 2;
int attackDamage = 5;
int counterWalking = 0;
No handling of delta time whatsoever
Your code will run at different speeds depending on how fast the main loop is running. You never measure frame time to base your update code on. This even more so points out how much those are magic constants above in the player class.
while (window.isOpen())
{
.......
Player1.update();
Player1.updateMovement();
.......
}
And a mention of delta time wouldn't be complete without this link:
http://gafferongames.com/game-physics/fix-your-timestep/Massive unused #includes
From
enity.h when enity is a class that doesn't encapsulate anything and it only has 3 members.
#include <stdio.h>
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
#include <random>
#include <cmath>
#include "ResourcePath.hpp"
#include <cstdlib>
#include <functional>
#include <tgmath.h>
#include <deque>
#include <list>
#include <vector>
#include <unistd.h>
using namespace std;
//#include "randomFunction.h"
...
class entity
{
public:
sf::RectangleShape rect;
sf::Sprite sprite;
sf::Text text;
private:
protected:
};
Enity class doesn't encapsulate anything, might as well typdef struct
Yea the typedef struct part is sarcastic because then you can't have your player inherit from enity, but part of writing C++ and OOP is encapsulation. You shouldn't just make all members public so anybody can fiddle with them. I'm not writing a book here on it because there is many resources on this.
Mix of *.hpp and *.h extensions
You should pick one convention and stick with it. *.h generally refers to C code and *.hpp to C++ code. But now that I look at the zip package again I see the only reason there is a mixture of *.hpp and *.h is because you copy and pasted the
ResourcePath.hpp and
ResourcePath.mm from the SFML source code.
http://stackoverflow.com/questions/152555/h-or-hpp-for-your-class-definitionsStoring textures within enities
When you store textures within enities this will cause a texture to be loaded for each enity. This will cause decreased performance and more memory usage. It is totally unacceptable once you start making a serious game.
Shamelessly stealing textures without credit
To quote the author that posted the sprite sheet.
you need to ask permission from
cool.. just get it.. don't forget to credit
So without contacting the author directly it seems as if you need permission to use his work and also need to give him credit.