aboutsummaryrefslogtreecommitdiff
path: root/src/entities
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-07 23:10:23 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-07 23:10:23 -0600
commite5268813dcbdc0d90a081b2223ebc21749038635 (patch)
tree7c917996749e4123fb1fe49ddd1ed3b8f7e92334 /src/entities
parenta90e1987de75cfecc2693952625af8cce507ae95 (diff)
Better world
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/antifaShip.c19
-rw-r--r--src/entities/antifaShip.h2
-rw-r--r--src/entities/soldato.c18
-rw-r--r--src/entities/soldato.h12
4 files changed, 39 insertions, 12 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c
index 1944053..f43a7df 100644
--- a/src/entities/antifaShip.c
+++ b/src/entities/antifaShip.c
@@ -1,28 +1,21 @@
#include "antifaShip.h"
-#include <raylib.h>
+#include "game.h"
-void initAntifaShip(Entity * entity) {
- entity->model = LoadModel("/home/nathan/Documents/KillaFacsista/assets/antifaShip.obj");
+void initAntifaShip(Entity * entity, Game * game) {
+ entity->model = &game->assets.models[ANTIFA_SHIP_ASSET];
entity->useAcceleration = true;
entity->acceleration = (EntityAcceleration){
.speedUp = 30.0,
.speedDown = 15,
- .rotationUp = (Vector3){0.6, 0.6, 0.6},
- .rotationDown = (Vector3){0.6, 0.6, 0.6}
+ .rotation = (Vector3){0.7, 0.7, 0.7}
};
}
void closeAntifaShip(Entity * entity) {
- UnloadModel(entity->model);
}
void updateAntifaShip(Game * game, Entity * entity, EntityId id) {
-}
-
-void drawAntifaShip(Game * game, Entity * entity, EntityId id) {
- entityDraw(entity);
-
Vector3 stick = (Vector3){
GetGamepadAxisMovement(0, 1),
-GetGamepadAxisMovement(0, 0),
@@ -33,3 +26,7 @@ void drawAntifaShip(Game * game, Entity * entity, EntityId id) {
entityJoystickControl(entity, stick, fabs(GetGamepadAxisMovement(0, 3) * 300.0));
}
+
+void drawAntifaShip(Game * game, Entity * entity, EntityId id) {
+ entityDraw(entity);
+}
diff --git a/src/entities/antifaShip.h b/src/entities/antifaShip.h
index 15e9009..a1b97d2 100644
--- a/src/entities/antifaShip.h
+++ b/src/entities/antifaShip.h
@@ -4,7 +4,7 @@
#ifndef ANTIFA_SHIP_H
#define ANTIFA_SHIP_H
-void initAntifaShip(Entity * entity);
+void initAntifaShip(Entity * entity, Game * game);
void closeAntifaShip(Entity * entity);
void updateAntifaShip(Game * game, Entity * entity, EntityId id);
void drawAntifaShip(Game * game, Entity * entity, EntityId id);
diff --git a/src/entities/soldato.c b/src/entities/soldato.c
new file mode 100644
index 0000000..c1903d4
--- /dev/null
+++ b/src/entities/soldato.c
@@ -0,0 +1,18 @@
+#include "soldato.h"
+#include "game.h"
+
+void initSoldato(Entity * entity, Game * game) {
+ entity->model = &game->assets.models[ANTIFA_SHIP_ASSET];
+ entity->velocity.angularVelocity = (AxisAngle){(Vector3){1.0, 1.0, 1.0}, 1.0};
+}
+
+void closeSoldato(Entity * entity) {
+}
+
+void updateSoldato(Game * game, Entity * entity, EntityId id) {
+ entityUpdateRotation(entity);
+}
+
+void drawSoldato(Game * game, Entity * entity, EntityId id) {
+ entityDraw(entity);
+}
diff --git a/src/entities/soldato.h b/src/entities/soldato.h
new file mode 100644
index 0000000..4069b26
--- /dev/null
+++ b/src/entities/soldato.h
@@ -0,0 +1,12 @@
+#include "gameCommon.h"
+#include "entity.h"
+
+#ifndef SOLDATO_H
+#define SOLDATO_H
+
+void initSoldato(Entity * entity, Game * game);
+void closeSoldato(Entity * entity);
+void updateSoldato(Game * game, Entity * entity, EntityId id);
+void drawSoldato(Game * game, Entity * entity, EntityId id);
+
+#endif