diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-18 05:54:30 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-18 05:54:30 -0600 |
commit | f3f5fedbf591c10fa675a32103bab9480b42abe8 (patch) | |
tree | 54b46a23279cc45091393762c0d01b9c3637b729 /src/bullets.h | |
parent | 77a06748f9f394486cad833e2ca351e8dbcc7361 (diff) |
Bullet system added
Diffstat (limited to 'src/bullets.h')
-rw-r--r-- | src/bullets.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/bullets.h b/src/bullets.h new file mode 100644 index 0000000..a01a967 --- /dev/null +++ b/src/bullets.h @@ -0,0 +1,34 @@ +#include "gameCommon.h" +#include "entity.h" + +#ifndef BULLET_H +#define BULLET_H + +// Just a simple, deadly, bullet. +typedef struct Bullet { + bool hit; + Ray ray; + EntityId fromId; + EntityFingerprint fromFingerprint; // Shooter gets shot before bullet hits object hehe. + float damage; +} Bullet; + +// All the simple, deadly, bullets. +typedef struct Bullets { + Bullet * bullets; + size_t bulletsCount; +} Bullets; + +// Create the simple, deadly, bullet. offset is the bullet offset from the entity. +Bullet createBullet(Entity entity, Vector3 direction, Vector3 offset, float damage); + +void initBullets(Bullets * bullets); +void freeBullets(Bullets * bullets); + +KfError addBullet(Bullets * bullets, Bullet bullet); +KfError popBackBullets(Bullets * bullets); + +void updateBullets(Game * game, Bullets * bullets); +void updateBullet(Game * game, Bullet * bullet); + +#endif |