diff options
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); +} |