aboutsummaryrefslogtreecommitdiff
path: root/src/entities
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities')
-rw-r--r--src/entities/antifaShip.c11
-rw-r--r--src/entities/antifaShip.h1
-rw-r--r--src/entities/maresciallo.c19
-rw-r--r--src/entities/maresciallo.h4
-rw-r--r--src/entities/soldato.c4
5 files changed, 18 insertions, 21 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c
index b90060e..1ba8db9 100644
--- a/src/entities/antifaShip.c
+++ b/src/entities/antifaShip.c
@@ -152,17 +152,16 @@ void fireBulletAntifa(Game * game, Entity * entity) {
if (t - data->timeSinceLastBullet < ANTIFA_BULLET_COOLDOWN)
return;
- puts("shoot shoot");
-
- Bullet bullet = createBulletFromDirection(*entity, data->gunTarget, 1.0);
+ Bullet bullet = createBulletFromDirection(*entity, data->gunTarget, ANTIFA_BULLET_DAMAGE);
BulletHitInfo info = shootBullet(&game->world, bullet);
data->lastBulletShot = bullet;
if (info.hit) {
Entity * hitEntity = getEntityFromWorld(game->world, info.hitId);
- printVector3(hitEntity->position);
- } else {
- puts("you stink");
+
+ // We were the fucker that killed this low iq fascist!
+ if (hitEntity->health <= 0.0)
+ hitEntity->killedByPlayer = true;
}
data->timeSinceLastBullet = t;
diff --git a/src/entities/antifaShip.h b/src/entities/antifaShip.h
index 2781584..a99e419 100644
--- a/src/entities/antifaShip.h
+++ b/src/entities/antifaShip.h
@@ -8,6 +8,7 @@
#define ANTIFA_SHIP_MAX_SPEED 200.0
#define ANTIFA_BULLET_COOLDOWN 0.5
#define ANTIFA_DRAW_BULLET_FOR 0.05
+#define ANTIFA_BULLET_DAMAGE 0.5
// Auto target shit.
#define ANTIFA_START_AUTO_TARGET_MAX 0.5 // How far off auto target can be entail it drops.
diff --git a/src/entities/maresciallo.c b/src/entities/maresciallo.c
index b03d366..4b6ce03 100644
--- a/src/entities/maresciallo.c
+++ b/src/entities/maresciallo.c
@@ -40,6 +40,8 @@ void initMaresciallo(Entity * entity, Game * game) {
.rotationSpeed = MARESCIALLO_ROTATION_SPEED,
.applyRotation = true
};
+
+ data->gunTarget = Vector3One();
}
void closeMaresciallo(Entity * entity) {
@@ -99,24 +101,17 @@ void updateGunMaresciallo(Game * game, Entity * entity) {
Maresciallo * data = (Maresciallo*)entity->data;
Entity * player = getEntityFromWorld(game->world, 0);
- if (t - data->timeSinceLastBulletShot < MARESCIALLO_BULLET_COOLDOWN)
- return;
-
- SetRandomSeed(time(NULL));
+ // Aim at the stupid fucker playing this stupid ass game.
+ Vector3 target = Vector3Normalize(Vector3Subtract(player->position, entity->position));
+ data->gunTarget = Vector3Lerp(data->gunTarget, target, GetFrameTime() * MARESCIALLO_GUN_TARGETING_SPEED);
- // Shoots bullet that cant miss if random thingy.
- if (GetRandomValue(1, MARESCIALLO_CHANGE_OF_HIT) != 1)
+ if (t - data->timeSinceLastBulletShot < MARESCIALLO_BULLET_COOLDOWN)
return;
- Vector3 direction = Vector3Subtract(player->position, entity->position);
- direction = Vector3Normalize(direction);
-
// Create and shoot bullet.
- Bullet bullet = createBulletFromDirection(*entity, direction, MARESCIALLO_BULLET_DAMAGE);
+ Bullet bullet = createBulletFromDirection(*entity, data->gunTarget, MARESCIALLO_BULLET_DAMAGE);
BulletHitInfo hit = shootBulletAtEntity(player, bullet);
- //printf("This fucker hithit ajskdlfjkl %d\n", hit.hit);
-
data->timeSinceLastBulletShot = t;
}
diff --git a/src/entities/maresciallo.h b/src/entities/maresciallo.h
index b853ef4..2d46eeb 100644
--- a/src/entities/maresciallo.h
+++ b/src/entities/maresciallo.h
@@ -11,7 +11,7 @@
#define MARESCIALLO_BULLET_COOLDOWN 3.0
#define MARESCIALLO_BULLET_DAMAGE 0.01
-#define MARESCIALLO_CHANGE_OF_HIT 10
+#define MARESCIALLO_GUN_TARGETING_SPEED 20.0
#define MARESCIALLO_MISSILE_COOLDOWN 5.0
@@ -19,6 +19,8 @@ typedef struct Maresciallo {
EntityFlyToPointInfo flyToPoint;
double timeSinceLastBulletShot;
double timeSinceLastMissileShot;
+
+ Vector3 gunTarget;
} Maresciallo;
void initMaresciallo(Entity * entity, Game * game);
diff --git a/src/entities/soldato.c b/src/entities/soldato.c
index 7318d5b..28e9b67 100644
--- a/src/entities/soldato.c
+++ b/src/entities/soldato.c
@@ -123,8 +123,8 @@ void updateSoldatoGuns(Game * game, Entity * entity) {
Bullet bullet = createBulletFromDirection(*entity, data->gunTarget, SOLDATO_BULLET_DAMAGE);
BulletHitInfo hit = shootBulletAtEntity(player, bullet);
- if (hit.hit)
- printf("This fucker hit %lf\n", t);
+ // if (hit.hit)
+ // printf("This fucker hit %lf\n", t);
data->timeSinceLastShot = t;
}