diff options
author | BoredGuy <osome3717@gmail.com> | 2025-08-26 19:54:09 +0300 |
---|---|---|
committer | BoredGuy <osome3717@gmail.com> | 2025-08-26 19:54:09 +0300 |
commit | f95068d73410aa6d01e8ba91b430ca05d404a57b (patch) | |
tree | 84de322f972182510e48aaa374ae8a62ac3ee2b5 /src/barrel.c | |
parent | 87d07175058ee4ae18fce608de81c68d7d9bb178 (diff) |
Added barrel, next up sprite Z-sorting(ugh)
Diffstat (limited to 'src/barrel.c')
-rw-r--r-- | src/barrel.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/barrel.c b/src/barrel.c new file mode 100644 index 0000000..b0ce9a7 --- /dev/null +++ b/src/barrel.c @@ -0,0 +1,41 @@ +#include "barrel.h" +#include "barrel_data.h" +#include "utils.h" +#include "assets.h" + +void AddBarrel(float xpos, float ypos) { + Entity barrel = {0}; + barrel.type = Barrel_Entity; + + barrel.position = (Vector2) {xpos, ypos}; + barrel.flags |= (ENTITY_PHYSICS_ACTIVE | ENTITY_VISIBLE); + + Asset* barrelTexture = GetMatchingAssetExitOnFail("barrel", Texture_Asset); + + Sprite barrelSprite = (Sprite) { + .texture = barrelTexture->texture, + .layer = Foreground_Layer, + + .destRect = destRect, + .srcRect = { + .x = 0, + .y = 0, + .width = barrelTexture->texture.width / 2, + .height = barrelTexture->texture.height + } + }; + + AddSpriteToEntity(&barrel, barrelSprite); + + barrel.physicsCollider = physicsCollider; + +#ifdef BEATEMUP_DEBUG + barrel.physicsColliderColor = RED; +#endif + + AddEntity(&barrel); +} + +void UpdateBarrel(float dt) { + UNUSED(dt); +} |