From f3f5fedbf591c10fa675a32103bab9480b42abe8 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Tue, 18 Jul 2023 05:54:30 -0600 Subject: Bullet system added --- src/bullets.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/bullets.h (limited to 'src/bullets.h') 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 -- cgit v1.2.3