aboutsummaryrefslogtreecommitdiff
path: root/game/enemy
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-10 10:12:41 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-10 10:12:41 +0100
commitc1325d3e979e294fced8f80ce43dd1eb86d7f5df (patch)
tree8a9db668164e67811fd7f655af3332418c6145a0 /game/enemy
parentcb81d9c3bbb57404dc469dd16cf3bb9c15c1cd5d (diff)
balance changes
Diffstat (limited to 'game/enemy')
-rw-r--r--game/enemy/EnemyBulletSubScene.cpp2
-rw-r--r--game/enemy/EnemyScript.cpp11
2 files changed, 8 insertions, 5 deletions
diff --git a/game/enemy/EnemyBulletSubScene.cpp b/game/enemy/EnemyBulletSubScene.cpp
index fb3a4cd..1406660 100644
--- a/game/enemy/EnemyBulletSubScene.cpp
+++ b/game/enemy/EnemyBulletSubScene.cpp
@@ -28,7 +28,7 @@ int EnemyBulletSubScene::create(Scene & scn, int counter) {
Rigidbody & bullet_body = bullet.add_component<Rigidbody>(Rigidbody::Data {
.gravity_scale = 0,
.body_type = Rigidbody::BodyType::KINEMATIC,
- .linear_velocity = vec2 {-350, 0},
+ .linear_velocity = vec2 {-300, 0},
.kinematic_collision = false,
.collision_layers = {COLL_LAY_BOT_TOP, COLL_LAY_MISSILE, COLL_LAY_ZAPPER},
.collision_layer = COLL_LAY_BULLET
diff --git a/game/enemy/EnemyScript.cpp b/game/enemy/EnemyScript.cpp
index c677dac..e3c8e9f 100644
--- a/game/enemy/EnemyScript.cpp
+++ b/game/enemy/EnemyScript.cpp
@@ -14,6 +14,7 @@
#include <crepe/api/Transform.h>
#include <crepe/types.h>
#include <random>
+#include <iostream>
using namespace crepe;
using namespace std;
EnemyScript::EnemyScript() {
@@ -72,7 +73,7 @@ void EnemyScript::fixed_update(duration_t dt) {
if (elapsed > shot_delay) {
this->shoot(transform.position);
last_fired = now;
- this->shot_delay = std::chrono::duration<float>(Random::f(4, 1));
+ this->shot_delay = std::chrono::duration<float>(Random::f(4, 1.5));
}
}
@@ -100,7 +101,7 @@ bool EnemyScript::spawn_enemy(const SpawnEnemyEvent & e) {
Transform & cam_transform = this->get_components_by_name<Transform>("camera").front();
vec2 half_screen = camera.viewport_size / 2;
- float x_value = cam_transform.position.x + half_screen.x - 60 * (1 + e.column);
+ float x_value = cam_transform.position.x + half_screen.x - 40 * (1 + e.column);
uniform_real_distribution<float> dist(
cam_transform.position.y - half_screen.y + 100,
cam_transform.position.y + half_screen.y - 100
@@ -131,14 +132,16 @@ void EnemyScript::set_hit_blink(bool status) {
bool EnemyScript::on_collide(const CollisionEvent & e) {
if (!this->alive) return false;
if (e.info.other.metadata.tag == "player_bullet") {
+ cout << "health: " << health << endl;
this->health--;
last_hit = std::chrono::steady_clock::now();
//Sprite& sprite;
set_hit_blink(true);
- }
- if (health <= 0) {
+ if (health <= 0) {
this->death();
}
+ }
+
//body_animator.play();
return false;