diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-08 13:52:43 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-08 13:52:43 +0100 |
commit | fcec9d7598f0808d4081120a9cb2036bdea59737 (patch) | |
tree | 4963d2f791a4c3ba27d357ad38345094a8e65fc4 /game/enemy/EnemyBulletSubScene.cpp | |
parent | 1413beea3b506b15b9f0080cec29c745d1ef88da (diff) |
make format
Diffstat (limited to 'game/enemy/EnemyBulletSubScene.cpp')
-rw-r--r-- | game/enemy/EnemyBulletSubScene.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/game/enemy/EnemyBulletSubScene.cpp b/game/enemy/EnemyBulletSubScene.cpp index 4f95ce4..edd8f0c 100644 --- a/game/enemy/EnemyBulletSubScene.cpp +++ b/game/enemy/EnemyBulletSubScene.cpp @@ -1,47 +1,49 @@ #include <string> -#include <crepe/api/GameObject.h> -#include <crepe/api/Scene.h> +#include "../Config.h" +#include "EnemyConfig.h" +#include <crepe/api/AI.h> +#include <crepe/api/Animator.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/BehaviorScript.h> -#include <crepe/api/Animator.h> +#include <crepe/api/Scene.h> #include <crepe/api/Sprite.h> -#include <crepe/api/AI.h> -#include "../Config.h" -#include "EnemyConfig.h" +#include "../Random.h" +#include "EnemyBulletScript.h" #include "EnemyBulletSubScene.h" #include "EnemyScript.h" -#include "EnemyBulletScript.h" -#include "../Random.h" using namespace crepe; using namespace std; -int EnemyBulletSubScene::create(Scene & scn, int counter){ +int EnemyBulletSubScene::create(Scene & scn, int counter) { string unique_name = "enemy_bullet_" + to_string(counter++); - GameObject bullet = scn.new_object(unique_name.c_str(),"enemy_bullet",ENEMY_BULLET_POOL_LOCATION,0,1); - - Rigidbody& bullet_body = bullet.add_component<Rigidbody>(Rigidbody::Data { + GameObject bullet = scn.new_object( + unique_name.c_str(), "enemy_bullet", ENEMY_BULLET_POOL_LOCATION, 0, 1 + ); + + Rigidbody & bullet_body = bullet.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 0, .body_type = Rigidbody::BodyType::KINEMATIC, - - .linear_velocity = vec2{-250,0}, + + .linear_velocity = vec2 {-250, 0}, .kinematic_collision = false, .collision_layers = {COLL_LAY_MISSILE}, .collision_layer = COLL_LAY_BULLET }); bullet_body.active = false; - BoxCollider& bullet_collider = bullet.add_component<BoxCollider>(vec2(60, 30)); + BoxCollider & bullet_collider = bullet.add_component<BoxCollider>(vec2(60, 30)); //bullet_collider.active = false; Asset bullet_asset {"asset/other_effects/effect_smgbullet_x2.png"}; Sprite & bullet_sprite = bullet.add_component<Sprite>( bullet_asset, Sprite::Data { - .flip = {true,false}, + .flip = {true, false}, .sorting_in_layer = SORT_IN_LAY_OBSTACLES, .order_in_layer = 1, - .size = vec2(60,0), + .size = vec2(60, 0), } ); bullet.add_component<BehaviorScript>().set_script<EnemyBulletScript>(); |