[Added] Enemy player detection and shooting, [Moved] Lots of entity code to cpp files to avoid circular dependencies

This commit is contained in:
Ninjaws
2024-12-17 20:08:35 +01:00
parent e8c78770b5
commit 2400b0500a
21 changed files with 820 additions and 701 deletions
+19 -12
View File
@@ -4,39 +4,46 @@
#include "services/AssetService.h"
#include "entities/TextureWrapper.h"
class Crate {
class Crate
{
public:
Crate() {
this->texture = TextureWrapper(AssetService::getInstance().getSprite(ESprite::CRATE),{32,32});
Crate()
{
this->texture = TextureWrapper(AssetService::getInstance().getSprite(ESprite::CRATE), {32, 32});
}
Crate(Vector2 pos) {
this->texture = TextureWrapper(AssetService::getInstance().getSprite(ESprite::CRATE),{32,32}, pos);
Crate(Vector2 pos)
{
this->texture = TextureWrapper(AssetService::getInstance().getSprite(ESprite::CRATE), {32, 32}, pos);
}
void logic() {
void logic()
{
}
bool hasBeenHit() {
bool hasBeenHit()
{
return this->hit;
}
void setHit(bool hit) {
void setHit(bool hit)
{
this->hit = hit;
}
void draw() {
void draw()
{
DrawTexture(this->texture.getTexture(), this->texture.getPosition().x, this->texture.getPosition().y, WHITE);
}
TextureWrapper& getObject() {
TextureWrapper &getObject()
{
return this->texture;
}
private:
TextureWrapper texture;
bool hit; // Whether a PBullet has hit the crate
bool hit; // Whether a PBullet has hit the crate
};
#endif