feat: increased size of the player collider

This commit is contained in:
Sara 2023-11-26 13:11:30 +01:00
parent e0a05e546e
commit 94cc7e8c6c

View file

@ -13,10 +13,12 @@ void Internal_PlayerInitInput(Player* self) {
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_A)),
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_D)),
InputEvent_Float)), (InputDelegateFn)PlayerHorizontalInput);
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_new(
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_S)),
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_W)),
InputEvent_Float)), (InputDelegateFn)PlayerVerticalInput);
playerinput_add(self->playerInput, KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), (InputDelegateFn)PlayerAttackInput);
}
@ -26,26 +28,33 @@ Player* MakePlayer() {
*self = (Player) {
.transform = IdentityTransform,
.rigidbody = NULL,
.physicsCollider = NULL,
.playerInput = playerinput_new(self, -1),
.moveInput = ZeroVector,
.attackInput = 0,
.facing = 1,
.sprite = sprite_new_empty(),
.idle = NULL,
.walk = NULL,
.jab_a = NULL,
.jab_b = NULL,
.animationStateMachine = NULL,
};
self->rigidbody = rigidbody_make(Player_as_Transformable(self));
self->physicsCollider = collider_new(self->rigidbody, shape_new((Vector[]){
MakeVector(-0.15, -0.065),
MakeVector( 0.15, -0.065),
MakeVector( 0.15, 0.065),
MakeVector(-0.15, 0.065)
}, 4), 0, 0x1);
self->physicsCollider = collider_new(Player_as_PhysicsEntity(self), shape_new((Vector[]){
MakeVector(-0.2, -0.065),
MakeVector( 0.2, -0.065),
MakeVector( 0.2, 0.065),
MakeVector(-0.2, 0.065)
}, 4), 0, PHYSICS_LAYER_DEFAULT);
sprite_set_origin(self->sprite, MakeVector(0.45f, 0.925f));