1) How can I get the player sprite to face the mouse?
You need to first get the difference in position for the mouse and player. Then you arctan (tan inverse) the x/y of the position difference. Finally use sf::Sprite::SetRotation() to set the angle. Here is the code I use in uzf:
void Player::onUpdate() {
Input *input = Input::getInstance();
sf::Vector2f mouseToPlayer = input->getMousePosition() - getPosition();
float facingAngle = atan(mouseToPlayer.x/mouseToPlayer.y);
if(mouseToPlayer.x == 0 && mouseToPlayer.y == 0)
facingAngle = 0;
facingAngle *= 180/3.14159; // Convert to degrees
// atan() returns an angle between 0-180 therefore it needs an offset of 180
// when it is in the negative-Y quadrants
if(mouseToPlayer.y >= 0) {
facingAngle += 180;
}
setAngle(facingAngle);
...
2) how can I get the Zombies to go towards the player?
This is more trickier.
If you don't have any walls and obstacles, then you can make the zombies head straight for the player. Again using some simple maths you can figure out what the x and y speed of the zombie needs to be.
If you have walls however then you will need to do some pathfinding. Try looking up A* (a star) path finding. I used the micropather library instead of writing my own A* code. It does most of the work for you but it isn't fully straightforward.
This was probably the trickiest part of the game for me to code. There were issues like unit and wall sizes not having the same grid size that took me a while to find a workaround for.
3) How should I do the maps? Are their any editors that would work best for my needs (medium sized maps with collision and as the player moves, it scrolls.)
For this you have 2 choices: Tile-based map editors, and vector based map editors.
Tile-based map editors are the easiest to use but also the most inflexible as everything is based on the grid size. Most of them export to easy to parse files and so the code to load maps is simpler.
For UZF I used Inkscape, a vector based editor. Inkscape is actually a generic vector editing program but you can still use it to make game maps. It is the most flexible option as it has things like polygons, layers and more advanced functionality. You can also use the description fields of shapes to add game related object information. However the .svg file format is in xml and is quite complicated. So I only implemented a very basic implementation that only handles rectangles with no rotation.
Both types of map editors support medium sized maps and collision. Scrolling is something that you have to code yourself. Thankfully SFML's View classes make scrolling quite simple.
Some parts of the game can be tricky but the more you code the better you get
. Good luck with your project.