made the entity position into a rectangle
This commit is contained in:
@@ -5,10 +5,9 @@
|
||||
#include <sys/types.h>
|
||||
#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;
|
||||
position.x = x;
|
||||
position.y = y;
|
||||
rect = Rect;
|
||||
health = h;
|
||||
maxhealth = maxh;
|
||||
nametag = n;
|
||||
@@ -23,5 +22,5 @@ void Entity::Update() {
|
||||
}
|
||||
|
||||
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 {
|
||||
ID id;
|
||||
raylib::Vector2 position;
|
||||
raylib::Rectangle rect;
|
||||
int health;
|
||||
int maxhealth;
|
||||
std::string nametag;
|
||||
@@ -22,7 +22,7 @@ struct Entity {
|
||||
void Update();
|
||||
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