aboutsummaryrefslogtreecommitdiff
path: root/game/player/PlayerBulletSubScene.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-08 13:52:43 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-08 13:52:43 +0100
commitfcec9d7598f0808d4081120a9cb2036bdea59737 (patch)
tree4963d2f791a4c3ba27d357ad38345094a8e65fc4 /game/player/PlayerBulletSubScene.cpp
parent1413beea3b506b15b9f0080cec29c745d1ef88da (diff)
make format
Diffstat (limited to 'game/player/PlayerBulletSubScene.cpp')
-rw-r--r--game/player/PlayerBulletSubScene.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/game/player/PlayerBulletSubScene.cpp b/game/player/PlayerBulletSubScene.cpp
index 96c6b9a..62bcf3e 100644
--- a/game/player/PlayerBulletSubScene.cpp
+++ b/game/player/PlayerBulletSubScene.cpp
@@ -1,51 +1,52 @@
#include <string>
-#include <crepe/api/GameObject.h>
-#include <crepe/api/Scene.h>
+#include "../Config.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 "PlayerBulletScript.h"
#include "PlayerBulletSubScene.h"
#include "PlayerScript.h"
-#include "PlayerBulletScript.h"
using namespace crepe;
using namespace std;
-int PlayerBulletSubScene::create(Scene & scn,int counter){
+int PlayerBulletSubScene::create(Scene & scn, int counter) {
string unique_name = "player_bullet_" + to_string(counter++);
- GameObject player_bullet = scn.new_object(unique_name.c_str(),"player_bullet",vec2{0,-850},0,1);
-
- Rigidbody& player_bullet_body = player_bullet.add_component<Rigidbody>(Rigidbody::Data {
+ GameObject player_bullet
+ = scn.new_object(unique_name.c_str(), "player_bullet", vec2 {0, -850}, 0, 1);
+
+ Rigidbody & player_bullet_body = player_bullet.add_component<Rigidbody>(Rigidbody::Data {
.gravity_scale = 0,
.body_type = Rigidbody::BodyType::KINEMATIC,
- .linear_velocity = vec2{300,0},
+ .linear_velocity = vec2 {300, 0},
.angular_velocity = 150,
.kinematic_collision = false,
.collision_layers = {COLL_LAY_ENEMY},
-
+
.collision_layer = COLL_LAY_PLAYER_BULLET,
-
-
+
});
player_bullet_body.active = false;
- BoxCollider& player_bullet_collider = player_bullet.add_component<BoxCollider>(vec2(30, 30));
+ BoxCollider & player_bullet_collider
+ = player_bullet.add_component<BoxCollider>(vec2(30, 30));
Asset player_bullet_asset {"asset/other_effects/crepe.png"};
Sprite & player_bullet_sprite = player_bullet.add_component<Sprite>(
player_bullet_asset,
Sprite::Data {
- .flip = {true,false},
+ .flip = {true, false},
.sorting_in_layer = SORT_IN_LAY_OBSTACLES,
.order_in_layer = 1,
- .size = vec2(30,0),
+ .size = vec2(30, 0),
}
);
- player_bullet.add_component<BehaviorScript>().set_script<PlayerBulletScript>().active = false;
+ player_bullet.add_component<BehaviorScript>().set_script<PlayerBulletScript>().active
+ = false;
return counter;
}