blob: b0ce9a72c8218b75ff6884b35f0cc83417c657a8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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);
}
|