aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/CollisionSystem.cpp
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-13 20:55:15 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-13 20:55:15 +0100
commitbdebe07d265eb009fe3b3d04371a449feff19325 (patch)
tree5cfd7c4f145d83852a3eb2d8e799f5525849cd5b /src/crepe/system/CollisionSystem.cpp
parentb57b61e06e6c0f1c7dfc939ef3bf52799749cfa0 (diff)
parentfea0c2f0f96e093962c5faf3643176e856b1e8f6 (diff)
improved readablity
Diffstat (limited to 'src/crepe/system/CollisionSystem.cpp')
-rw-r--r--src/crepe/system/CollisionSystem.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp
index 938ae82..7cafe82 100644
--- a/src/crepe/system/CollisionSystem.cpp
+++ b/src/crepe/system/CollisionSystem.cpp
@@ -319,13 +319,13 @@ void CollisionSystem::static_collision_handler(CollisionInfo & info) {
switch (info.resolution_direction) {
case Direction::BOTH:
//bounce
- if(info.this_rigidbody.data.elastisity_coefficient > 0){
+ if (info.this_rigidbody.data.elastisity_coefficient > 0) {
info.this_rigidbody.data.linear_velocity.y
- = -info.this_rigidbody.data.linear_velocity.y
- * info.this_rigidbody.data.elastisity_coefficient;
- info.this_rigidbody.data.linear_velocity.x
- = -info.this_rigidbody.data.linear_velocity.x
- * info.this_rigidbody.data.elastisity_coefficient;
+ = -info.this_rigidbody.data.linear_velocity.y
+ * info.this_rigidbody.data.elastisity_coefficient;
+ info.this_rigidbody.data.linear_velocity.x
+ = -info.this_rigidbody.data.linear_velocity.x
+ * info.this_rigidbody.data.elastisity_coefficient;
}
//stop movement
else {
@@ -336,11 +336,11 @@ void CollisionSystem::static_collision_handler(CollisionInfo & info) {
// Bounce
if (info.this_rigidbody.data.elastisity_coefficient > 0) {
info.this_rigidbody.data.linear_velocity.y
- = -info.this_rigidbody.data.linear_velocity.y
- * info.this_rigidbody.data.elastisity_coefficient;
+ = -info.this_rigidbody.data.linear_velocity.y
+ * info.this_rigidbody.data.elastisity_coefficient;
}
// Stop movement
- else{
+ else {
info.this_rigidbody.data.linear_velocity.y = 0;
info.this_transform.position.x -= info.resolution.x;
}
@@ -349,11 +349,11 @@ void CollisionSystem::static_collision_handler(CollisionInfo & info) {
// Bounce
if (info.this_rigidbody.data.elastisity_coefficient > 0) {
info.this_rigidbody.data.linear_velocity.x
- = -info.this_rigidbody.data.linear_velocity.x
- * info.this_rigidbody.data.elastisity_coefficient;
+ = -info.this_rigidbody.data.linear_velocity.x
+ * info.this_rigidbody.data.elastisity_coefficient;
}
// Stop movement
- else{
+ else {
info.this_rigidbody.data.linear_velocity.x = 0;
info.this_transform.position.y -= info.resolution.y;
}