made the entity position into a rectangle

This commit is contained in:
nosch
2025-08-31 03:32:14 +02:00
parent 0fbcf0ea99
commit b8f6238d31
2 changed files with 5 additions and 6 deletions
+3 -4
View File
@@ -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);
}
+2 -2
View File
@@ -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);
};