made the entity position into a rectangle
This commit is contained in:
@@ -5,10 +5,9 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Entity::Entity(ID Id, int x, int y, std::string &n, int h, int maxh) {
|
Entity::Entity(ID Id, raylib::Rectangle Rect, std::string &n, int h, int maxh) {
|
||||||
id = Id;
|
id = Id;
|
||||||
position.x = x;
|
rect = Rect;
|
||||||
position.y = y;
|
|
||||||
health = h;
|
health = h;
|
||||||
maxhealth = maxh;
|
maxhealth = maxh;
|
||||||
nametag = n;
|
nametag = n;
|
||||||
@@ -23,5 +22,5 @@ void Entity::Update() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Entity::Draw() {
|
void Entity::Draw() {
|
||||||
DrawTextureEx(entityTextures.GetTexture(id), position, 0, 0, WHITE);
|
DrawTextureEx(entityTextures.GetTexture(id), raylib::Vector2(rect.x, rect.y), 0, 0, WHITE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using ControllerFunc = std::function<void(Entity&)>;
|
|||||||
|
|
||||||
struct Entity {
|
struct Entity {
|
||||||
ID id;
|
ID id;
|
||||||
raylib::Vector2 position;
|
raylib::Rectangle rect;
|
||||||
int health;
|
int health;
|
||||||
int maxhealth;
|
int maxhealth;
|
||||||
std::string nametag;
|
std::string nametag;
|
||||||
@@ -22,7 +22,7 @@ struct Entity {
|
|||||||
void Update();
|
void Update();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
Entity(ID Id, int x, int y, std::string &n, int h, int maxh);
|
Entity(ID Id, raylib::Rectangle rect, std::string &n, int h, int maxh);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user