From 1bba6c86f19ee2ccdeb9b41d8a5a571ffcb2987b Mon Sep 17 00:00:00 2001
From: Sara <sara@saragerretsen.nl>
Date: Sat, 25 Nov 2023 11:34:10 +0100
Subject: [PATCH] feat(game): player and prop now implement get depth for
 behaviour entity

---
 game/src/Player.h | 5 ++++-
 game/src/Prop.h   | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/game/src/Player.h b/game/src/Player.h
index 445b539..fda0b33 100644
--- a/game/src/Player.h
+++ b/game/src/Player.h
@@ -56,6 +56,8 @@ Shape* PlayerGetCollisionShape(Player* self);
 void PlayerOnCollision(Player* self, Collision collision);
 void PlayerOnOverlap(Player* self, PhysicsEntity other);
 
+static long PlayerGetDepth(Player* self) { return -(int)(self->transform.position.y * 1000); }
+
 impl_Drop_for(Player,
     DestroyPlayer
 )
@@ -63,7 +65,8 @@ impl_Drop_for(Player,
 impl_BehaviourEntity_for(Player,
     PlayerStart,
     PlayerUpdate,
-    PlayerDraw
+    PlayerDraw,
+    PlayerGetDepth
 )
 
 impl_Transformable_for(Player,
diff --git a/game/src/Prop.h b/game/src/Prop.h
index 333fcfe..2dd03a4 100644
--- a/game/src/Prop.h
+++ b/game/src/Prop.h
@@ -32,6 +32,8 @@ Transform* PropGetTransform(Prop* self);
 RigidBody* PropGetRigidBody(Prop* self);
 Shape* PropGetCollisionShape(Prop* self);
 
+static long PropGetDepth(Prop* self) { return -(int)(self->transform.position.y * 1000); }
+
 impl_Transformable_for(Prop,
     PropGetTransform
 )
@@ -50,7 +52,8 @@ impl_Drop_for(Prop,
 impl_BehaviourEntity_for(Prop,
     PropStart,
     PropUpdate,
-    PropDraw
+    PropDraw,
+    PropGetDepth
 )
 
 #endif // !FIGHT_PROP_H