-
-
Save anonymous/40e2bf3bc4f2d812db34f2e10b8afa12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include "Includes.h" | |
class Player | |
{ | |
private: | |
sf::Texture texture; | |
sf::Sprite sprite; | |
sf::Vector2i source; | |
sf::Vector2f prevPosition, crntPosition; | |
unsigned int rows, columns; | |
unsigned int spriteWidth, spriteHeight; | |
unsigned int sheetWidth, sheetHeight; | |
unsigned int previousRow; | |
float frameCounter, switchFrame, frameSpeed; | |
// Corresponds to the row in the sprite sheet | |
enum Direction { Up, Left, Down, Right }; | |
public: | |
Player(); | |
Player(std::string filename, int rows, int columns, sf::Vector2f position); | |
void create(std::string filename, int rows, int columns, sf::Vector2f position); | |
void update(float timePerTick); | |
void draw(sf::RenderWindow &window, float alpha); | |
void moveFrame(float timePerTick); | |
void resetFrame(); | |
void movePlayer(float deltaTime); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment