aboutsummaryrefslogtreecommitdiff
path: root/src/bullets.h
blob: a01a967ba3afbb2d4845361cbfac61799fe59eb6 (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
#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