aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/enemy/EnemyBulletSubScene.cpp2
-rw-r--r--game/enemy/EnemyScript.cpp11
-rw-r--r--game/player/PlayerBulletSubScene.cpp2
-rw-r--r--game/scheduler/ObjectsScheduler.cpp4
4 files changed, 11 insertions, 8 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;
diff --git a/game/player/PlayerBulletSubScene.cpp b/game/player/PlayerBulletSubScene.cpp
index 5e1c66e..82ce4a9 100644
--- a/game/player/PlayerBulletSubScene.cpp
+++ b/game/player/PlayerBulletSubScene.cpp
@@ -24,7 +24,7 @@ int PlayerBulletSubScene::create(Scene & scn, int counter) {
Rigidbody & player_bullet_body = player_bullet.add_component<Rigidbody>(Rigidbody::Data {
.gravity_scale = 0,
.body_type = Rigidbody::BodyType::KINEMATIC,
- .linear_velocity = vec2 {400, 0},
+ .linear_velocity = vec2 {450, 0},
.angular_velocity = 300,
.kinematic_collision = false,
.collision_layers = {COLL_LAY_ENEMY, COLL_LAY_ZAPPER},
diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp
index 8415ef8..816e1ee 100644
--- a/game/scheduler/ObjectsScheduler.cpp
+++ b/game/scheduler/ObjectsScheduler.cpp
@@ -16,14 +16,14 @@ void ObjectsScheduler::preset_0() {
trigger_event<MissileSpawnEvent>(MissileSpawnEvent {});
trigger_event<MissileSpawnEvent>(MissileSpawnEvent {});
this->trigger_event<BattleStartEvent>(BattleStartEvent {
- .num_enemies = Random::i(3, 1),
+ .num_enemies = Random::i(2, 1),
.battle = false,
});
}
void ObjectsScheduler::preset_1() {
trigger_event<MissileSpawnEvent>(MissileSpawnEvent {});
this->trigger_event<BattleStartEvent>(BattleStartEvent {
- .num_enemies = Random::i(4, 1),
+ .num_enemies = Random::i(2, 1),
.battle = false,
});
}