modify entity class items

This commit is contained in:
2025-11-07 16:55:55 -05:00
parent 3216f4a7e0
commit f047348937
3 changed files with 30 additions and 24 deletions
+9 -3
View File
@@ -1,8 +1,10 @@
#ifndef ENTITY_H
#define ENTITY_H
#include "TileMap.h"
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/PrimitiveType.hpp>
#include <SFML/Graphics/Rect.hpp>
#include <SFML/Graphics/RenderStates.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Texture.hpp>
@@ -21,14 +23,18 @@ enum class MovementDir {
class Entity : public sf::Drawable, public sf::Transformable {
public:
Entity();
Entity(TileMap& map) : map(map) {};
//assumes entity texture is one row of various animation texture states
bool loadTexture(const std::filesystem::path& texturePath, sf::Vector2u tileSize, int tiles);
bool loadTexture(const std::filesystem::path& texturePath, sf::Vector2u graphicTileSize, int tiles);
void setTextureFrame(const sf::IntRect& rectangle);
protected:
TileMap map;
sf::VertexArray vertexArray;
sf::Texture texture;
int animationTiles;
int movementSpeed = 5;
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;