From fcec9d7598f0808d4081120a9cb2036bdea59737 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Wed, 8 Jan 2025 13:52:43 +0100 Subject: make format --- game/enemy/EnemyBulletScript.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'game/enemy/EnemyBulletScript.cpp') diff --git a/game/enemy/EnemyBulletScript.cpp b/game/enemy/EnemyBulletScript.cpp index 55160ab..65c0c23 100644 --- a/game/enemy/EnemyBulletScript.cpp +++ b/game/enemy/EnemyBulletScript.cpp @@ -1,39 +1,39 @@ -#include #include "EnemyBulletScript.h" #include -#include #include +#include +#include #include "EnemyConfig.h" using namespace crepe; using namespace std; -void EnemyBulletScript::init(){ - this->subscribe([this](const CollisionEvent& e) -> bool { +void EnemyBulletScript::init() { + this->subscribe([this](const CollisionEvent & e) -> bool { return this->on_collide(e); }); } -void EnemyBulletScript::fixed_update(crepe::duration_t dt){ - Transform& transform = this->get_component(); - Camera& camera = this->get_components_by_name("camera").front(); - Transform& cam_transform = this->get_components_by_name("camera").front(); - Rigidbody& bullet_body = this->get_component(); +void EnemyBulletScript::fixed_update(crepe::duration_t dt) { + Transform & transform = this->get_component(); + Camera & camera = this->get_components_by_name("camera").front(); + Transform & cam_transform = this->get_components_by_name("camera").front(); + Rigidbody & bullet_body = this->get_component(); //move transform.position.x += bullet_body.data.linear_velocity.x * dt.count(); vec2 half_screen = camera.viewport_size / 2; float despawn_location = cam_transform.position.x - half_screen.x - 50; - if(transform.position.x < despawn_location){ + if (transform.position.x < despawn_location) { this->despawn_bullet(); } } -void EnemyBulletScript::despawn_bullet(){ - Transform& transform = this->get_component(); - Rigidbody& bullet_body = this->get_component(); +void EnemyBulletScript::despawn_bullet() { + Transform & transform = this->get_component(); + Rigidbody & bullet_body = this->get_component(); bullet_body.active = false; transform.position = ENEMY_BULLET_POOL_LOCATION; } -bool EnemyBulletScript::on_collide(const CollisionEvent& e){ +bool EnemyBulletScript::on_collide(const CollisionEvent & e) { //cout << "collision happened with " << e.info.other.metadata.tag << endl; this->despawn_bullet(); return false; -- cgit v1.2.3