aboutsummaryrefslogtreecommitdiff
path: root/src/entities/mussolini.c
blob: 2770d2f5b81f83b13a46e0178a8e45f827b13084 (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 "mussolini.h"
#include "assets.h"
#include "game.h"

void initMussolini(Entity * entity, Game * game) {
	entity->model = &game->assets.models[MUSSOLINI_ASSET];
}

void closeMussolini(Entity * entity) {
}

void updateMussolini(Game * game, Entity * entity) {
	Entity * player = getEntityFromWorld(game->world, 0);

	float pitch = Vector2Angle(
		(Vector2){entity->position.y, entity->position.x},
		(Vector2){player->position.y, player->position.x}
	);

	float yaw = Vector2Angle(
		(Vector2){entity->position.x, entity->position.z},
		(Vector2){player->position.x, player->position.z}
	);

	entity->rotation = QuaternionFromEuler(
		pitch - (PI/2),
		-(yaw - (PI/2)),
		0.0
	);
}

void drawMussolini(Game * game, Entity * entity) {
	entityDraw(entity);
}