feat: enemy destroy now removes from physics world before destroying colliders and rigidbody

This commit is contained in:
Sara 2024-01-19 15:27:48 +01:00
parent 3756280796
commit 92bf07d050

View file

@ -103,11 +103,11 @@ void EnemyDraw(Enemy* self) {
void EnemyDestroy(Enemy* self) {
state_machine_destroy(self->behaviour);
physics_world_remove_entity(Enemy_as_PhysicsEntity(self));
collider_destroy(self->collider);
rigidbody_destroy(self->rigidbody);
sprite_destroy(self->sprite);
physics_world_remove_entity(Enemy_as_PhysicsEntity(self));
free(self);
}