aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-04 20:48:38 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-04 20:48:38 +0100
commit69634f05b00e0e01ab84ab14b6293c7a88c5fbe0 (patch)
treef7705d8afe8af2ccd744a09cafe4edebf47083a9 /src/example
parent24246e115c3b7829d2981a2f60ac77da657f2ed5 (diff)
added collision layers to example and unit test
Diffstat (limited to 'src/example')
-rw-r--r--src/example/game.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp
index 70c562e..a8d6d1b 100644
--- a/src/example/game.cpp
+++ b/src/example/game.cpp
@@ -44,12 +44,13 @@ public:
//define playable world
GameObject world = mgr.new_object(
"Name", "Tag", vec2{screen_size_width / 2, screen_size_height / 2}, 0, 1);
- world.add_component<Rigidbody>(
- Rigidbody::Data{.mass = 0,
- .gravity_scale = 0,
- .body_type = Rigidbody::BodyType::STATIC,
- .constraints = {0, 0, 0},
- .offset = {0, 0}});
+ world.add_component<Rigidbody>(Rigidbody::Data{
+ .mass = 0,
+ .gravity_scale = 0,
+ .body_type = Rigidbody::BodyType::STATIC,
+ .offset = {0, 0},
+ .collision_layers = {0},
+ });
world.add_component<BoxCollider>(
vec2{0, 0 - (screen_size_height / 2 + world_collider / 2)},
vec2{world_collider, world_collider});
@@ -73,6 +74,7 @@ public:
.constraints = {0, 0, 0},
.elastisity_coefficient = 1,
.offset = {0, 0},
+ .collision_layers = {0},
});
game_object1.add_component<BoxCollider>(vec2{0, 0}, vec2{20, 20});
game_object1.add_component<BehaviorScript>().set_script<MyScript>();