feat: player implements no message receiver
This commit is contained in:
parent
b1cecfc0ae
commit
53af5fb66d
|
@ -35,6 +35,7 @@ Player* MakePlayer() {
|
|||
.playerInput = playerinput_new(self, -1),
|
||||
.moveInput = ZeroVector,
|
||||
.attackInput = 0,
|
||||
.animationTriggers = 0,
|
||||
|
||||
.facing = 1,
|
||||
|
||||
|
@ -48,7 +49,7 @@ Player* MakePlayer() {
|
|||
.animationStateMachine = NULL,
|
||||
};
|
||||
|
||||
self->rigidbody = rigidbody_make(Player_as_Transformable(self));
|
||||
self->rigidbody = rigidbody_make(Player_as_PhysicsEntity(self));
|
||||
self->physicsCollider = collider_new(Player_as_PhysicsEntity(self), shape_new((Vector[]){
|
||||
MakeVector(-0.2, -0.065),
|
||||
MakeVector( 0.2, -0.065),
|
||||
|
@ -80,6 +81,7 @@ Player* SpawnPlayer(Vector location) {
|
|||
}
|
||||
|
||||
void DestroyPlayer(Player* self) {
|
||||
physics_world_remove_entity(Player_as_PhysicsEntity(self));
|
||||
collider_destroy(self->physicsCollider);
|
||||
rigidbody_destroy(self->rigidbody);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ typedef struct Player {
|
|||
|
||||
Vector moveInput;
|
||||
int attackInput;
|
||||
size_t animationTriggers;
|
||||
|
||||
int facing;
|
||||
|
||||
|
@ -59,6 +60,8 @@ void PlayerOnOverlap(Player* self, Collider* other);
|
|||
|
||||
static long PlayerGetDepth(Player* self) { return -10-(int)(self->transform.position.y * 1000); }
|
||||
|
||||
impl_no_MessageReceiver_for(Player)
|
||||
|
||||
impl_Drop_for(Player,
|
||||
DestroyPlayer
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue