aboutsummaryrefslogtreecommitdiff
path: root/src/bullets.h
blob: 45c96eac8ac24694b1ed4475494cb29ef53d22b6 (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
#include "gameCommon.h"
#include "entity.h"
#include "world.h"
#include <raylib.h>

#ifndef BULLET_H
#define BULLET_H

// Just a simple, deadly, bullet.
typedef struct Bullet {
	Ray ray;
	EntityId fromId;
	EntityFingerprint fromFingerprint;
	float damage;
} Bullet;

typedef struct BulletHitInfo {
	bool hit;
	bool killed;
	EntityId hitId;
	EntityFingerprint hitFingerprint;
} BulletHitInfo;

// Uses entity postion and direction to create bullet ray.
Bullet createBulletFromEntity(Entity entity, float damage);

// Uses direction argument for direction indeed.
Bullet createBulletFromDirection(Entity entity, Vector3 direction, float damage);

// Shoot this fucker.
BulletHitInfo shootBullet(World * world, Bullet bullet);

// Shott this fucker but only at one entity.
BulletHitInfo shootBulletAtEntity(Entity * entity, Bullet bullet);

#endif