aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2025-01-08 16:20:10 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2025-01-08 16:20:10 +0100
commitbb976ed881a989b8b2cec90c905d906d9b652a9d (patch)
treee0125ba5141542b2000125bda76495f0098a1e41 /game
parent8edce6775ab0639a2a6eee3e561d3de0bb0c2cf1 (diff)
`make format`
Diffstat (limited to 'game')
-rw-r--r--game/GameScene.cpp2
-rw-r--r--game/enemy/EnemyBulletSubScene.cpp2
-rw-r--r--game/enemy/EnemyScript.cpp7
-rw-r--r--game/enemy/EnemySubScene.cpp5
-rw-r--r--game/menus/shop/ShopMenuScene.cpp1
-rw-r--r--game/player/PlayerBulletSubScene.cpp2
-rw-r--r--game/scheduler/ObjectsScheduler.cpp12
-rw-r--r--game/scheduler/ObjectsScheduler.h6
-rw-r--r--game/workers/CollisionScript.cpp3
9 files changed, 18 insertions, 22 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp
index 34b0fcb..3ae64fb 100644
--- a/game/GameScene.cpp
+++ b/game/GameScene.cpp
@@ -20,8 +20,8 @@
#include "player/PlayerBulletPool.h"
#include "player/PlayerBulletSubScene.h"
#include "player/PlayerSubScene.h"
-#include "scheduler/ObjectsScheduler.h"
#include "prefab/ZapperPoolSubScene.h"
+#include "scheduler/ObjectsScheduler.h"
#include "workers/WorkersSubScene.h"
#include <cmath>
diff --git a/game/enemy/EnemyBulletSubScene.cpp b/game/enemy/EnemyBulletSubScene.cpp
index 5c31f1d..ad2ca9d 100644
--- a/game/enemy/EnemyBulletSubScene.cpp
+++ b/game/enemy/EnemyBulletSubScene.cpp
@@ -30,7 +30,7 @@ int EnemyBulletSubScene::create(Scene & scn, int counter) {
.linear_velocity = vec2 {-250, 0},
.kinematic_collision = false,
- .collision_layers = {COLL_LAY_MISSILE,COLL_LAY_ZAPPER},
+ .collision_layers = {COLL_LAY_MISSILE, COLL_LAY_ZAPPER},
.collision_layer = COLL_LAY_BULLET
});
bullet_body.active = false;
diff --git a/game/enemy/EnemyScript.cpp b/game/enemy/EnemyScript.cpp
index 8cf8b80..5c03539 100644
--- a/game/enemy/EnemyScript.cpp
+++ b/game/enemy/EnemyScript.cpp
@@ -4,12 +4,11 @@
#include "EnemyConfig.h"
#include <crepe/api/AI.h>
#include <crepe/api/Animator.h>
+#include <crepe/api/AudioSource.h>
#include <crepe/api/BoxCollider.h>
#include <crepe/api/ParticleEmitter.h>
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Transform.h>
-#include <crepe/api/AudioSource.h>
-#include <crepe/api/Animator.h>
#include <crepe/types.h>
#include <random>
using namespace crepe;
@@ -86,7 +85,7 @@ bool EnemyScript::on_collide(const CollisionEvent & e) {
if (e.info.other.metadata.tag == "player_bullet") {
this->despawn_enemy();
}
- Animator& body_animator = this->get_components<Animator>().front();
+ Animator & body_animator = this->get_components<Animator>().front();
body_animator.data.col = 2;
//body_animator.play();
BehaviorScript & enemy_script = this->get_component<BehaviorScript>();
@@ -115,7 +114,7 @@ void EnemyScript::shoot(const vec2 & location, float angle) {
= this->get_components_by_id<BoxCollider>(bullet_pos.game_object_id).front();
bullet_collider.active = true;
bullet_body.active = true;
- AudioSource& audio = this->get_component<AudioSource>();
+ AudioSource & audio = this->get_component<AudioSource>();
audio.play();
return;
}
diff --git a/game/enemy/EnemySubScene.cpp b/game/enemy/EnemySubScene.cpp
index 8316db9..607b9a9 100644
--- a/game/enemy/EnemySubScene.cpp
+++ b/game/enemy/EnemySubScene.cpp
@@ -2,13 +2,13 @@
#include <crepe/api/AI.h>
#include <crepe/api/Animator.h>
+#include <crepe/api/AudioSource.h>
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/BoxCollider.h>
#include <crepe/api/CircleCollider.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Rigidbody.h>
#include <crepe/api/Scene.h>
-#include <crepe/api/AudioSource.h>
#include <crepe/api/Sprite.h>
#include "../Config.h"
@@ -91,8 +91,7 @@ int EnemySubScene::create(Scene & scn, int enemy_counter) {
.looping = true,
}
);
- enemy.add_component<AudioSource>(Asset("asset/sfx/bike_gun_2.ogg")).volume
- = 0.1;
+ enemy.add_component<AudioSource>(Asset("asset/sfx/bike_gun_2.ogg")).volume = 0.1;
AI & ai_component = enemy.add_component<AI>(3000);
ai_component.path_follow_on();
BehaviorScript & enemy_script
diff --git a/game/menus/shop/ShopMenuScene.cpp b/game/menus/shop/ShopMenuScene.cpp
index 5ada0d3..d1ea81d 100644
--- a/game/menus/shop/ShopMenuScene.cpp
+++ b/game/menus/shop/ShopMenuScene.cpp
@@ -6,7 +6,6 @@
#include "../ButtonSubScene.h"
#include "../MenusConfig.h"
#include "types.h"
-#include "../../Config.h"
#include <crepe/api/Camera.h>
#include <crepe/api/Sprite.h>
diff --git a/game/player/PlayerBulletSubScene.cpp b/game/player/PlayerBulletSubScene.cpp
index 2d237de..795747b 100644
--- a/game/player/PlayerBulletSubScene.cpp
+++ b/game/player/PlayerBulletSubScene.cpp
@@ -27,7 +27,7 @@ int PlayerBulletSubScene::create(Scene & scn, int counter) {
.linear_velocity = vec2 {400, 0},
.angular_velocity = 10,
.kinematic_collision = false,
- .collision_layers = {COLL_LAY_ENEMY,COLL_LAY_ZAPPER},
+ .collision_layers = {COLL_LAY_ENEMY, COLL_LAY_ZAPPER},
.collision_layer = COLL_LAY_PLAYER_BULLET,
diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp
index 02d84c1..fca8fa2 100644
--- a/game/scheduler/ObjectsScheduler.cpp
+++ b/game/scheduler/ObjectsScheduler.cpp
@@ -2,8 +2,8 @@
#include "ObjectsScheduler.h"
-#include "../Random.h"
#include "../Config.h"
+#include "../Random.h"
#include "../missile/SpawnEvent.h"
#include "api/Rigidbody.h"
#include "api/Transform.h"
@@ -16,15 +16,17 @@ void ObjectsScheduler::preset_1() { trigger_event<MissileSpawnEvent>(MissileSpaw
void ObjectsScheduler::preset_2() { trigger_event<CreateZapperEvent>(CreateZapperEvent {}); }
void ObjectsScheduler::preset_3() {}
void ObjectsScheduler::preset_4() {}
-void ObjectsScheduler::boss_fight_1() {
+void ObjectsScheduler::boss_fight_1() {
this->get_components_by_name<Rigidbody>("camera").front().get().data.linear_velocity.x = 0;
this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x = 0;
- this->trigger_event<BattleStartEvent>(BattleStartEvent{.num_enemies = 2});
+ this->trigger_event<BattleStartEvent>(BattleStartEvent {.num_enemies = 2});
}
bool ObjectsScheduler::boss_fight_1_event() {
- this->get_components_by_name<Rigidbody>("camera").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02;
- this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02;
+ this->get_components_by_name<Rigidbody>("camera").front().get().data.linear_velocity.x
+ = PLAYER_SPEED * 0.02;
+ this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x
+ = PLAYER_SPEED * 0.02;
return false;
}
diff --git a/game/scheduler/ObjectsScheduler.h b/game/scheduler/ObjectsScheduler.h
index 56d72cb..bd0701b 100644
--- a/game/scheduler/ObjectsScheduler.h
+++ b/game/scheduler/ObjectsScheduler.h
@@ -1,17 +1,14 @@
#pragma once
-
-
#include "api/Script.h"
#include <functional>
#include <vector>
-
class ObjectsScheduler : public crepe::Script {
private:
std::vector<std::function<void()>> obstacles;
-
+
int last_boss_check = 0;
int last_obstacle_check = 0;
@@ -32,5 +29,4 @@ private:
public:
void init();
void fixed_update(crepe::duration_t dt);
-
};
diff --git a/game/workers/CollisionScript.cpp b/game/workers/CollisionScript.cpp
index 625044d..372bfec 100644
--- a/game/workers/CollisionScript.cpp
+++ b/game/workers/CollisionScript.cpp
@@ -49,7 +49,8 @@ bool CollisionScript::on_collision(const CollisionEvent & ev) {
bs_panic.active = false;
return false;
- } else if (ev.info.other.metadata.tag == "missile" || ev.info.other.metadata.tag == "enemy_bullet") {
+ } else if (ev.info.other.metadata.tag == "missile"
+ || ev.info.other.metadata.tag == "enemy_bullet") {
for (Animator & anim : animators) {
anim.active = false;
anim.set_anim(3);