feat: increased size of the player collider
This commit is contained in:
parent
e0a05e546e
commit
94cc7e8c6c
|
@ -13,10 +13,12 @@ void Internal_PlayerInitInput(Player* self) {
|
||||||
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_A)),
|
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_A)),
|
||||||
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_D)),
|
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_D)),
|
||||||
InputEvent_Float)), (InputDelegateFn)PlayerHorizontalInput);
|
InputEvent_Float)), (InputDelegateFn)PlayerHorizontalInput);
|
||||||
|
|
||||||
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_new(
|
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_new(
|
||||||
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_S)),
|
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_S)),
|
||||||
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_W)),
|
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_W)),
|
||||||
InputEvent_Float)), (InputDelegateFn)PlayerVerticalInput);
|
InputEvent_Float)), (InputDelegateFn)PlayerVerticalInput);
|
||||||
|
|
||||||
playerinput_add(self->playerInput, KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), (InputDelegateFn)PlayerAttackInput);
|
playerinput_add(self->playerInput, KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), (InputDelegateFn)PlayerAttackInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,26 +28,33 @@ Player* MakePlayer() {
|
||||||
|
|
||||||
*self = (Player) {
|
*self = (Player) {
|
||||||
.transform = IdentityTransform,
|
.transform = IdentityTransform,
|
||||||
|
|
||||||
.rigidbody = NULL,
|
.rigidbody = NULL,
|
||||||
.physicsCollider = NULL,
|
.physicsCollider = NULL,
|
||||||
|
|
||||||
.playerInput = playerinput_new(self, -1),
|
.playerInput = playerinput_new(self, -1),
|
||||||
.moveInput = ZeroVector,
|
.moveInput = ZeroVector,
|
||||||
.attackInput = 0,
|
.attackInput = 0,
|
||||||
|
|
||||||
|
.facing = 1,
|
||||||
|
|
||||||
.sprite = sprite_new_empty(),
|
.sprite = sprite_new_empty(),
|
||||||
|
|
||||||
.idle = NULL,
|
.idle = NULL,
|
||||||
.walk = NULL,
|
.walk = NULL,
|
||||||
.jab_a = NULL,
|
.jab_a = NULL,
|
||||||
.jab_b = NULL,
|
.jab_b = NULL,
|
||||||
|
|
||||||
.animationStateMachine = NULL,
|
.animationStateMachine = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
self->rigidbody = rigidbody_make(Player_as_Transformable(self));
|
self->rigidbody = rigidbody_make(Player_as_Transformable(self));
|
||||||
self->physicsCollider = collider_new(self->rigidbody, shape_new((Vector[]){
|
self->physicsCollider = collider_new(Player_as_PhysicsEntity(self), shape_new((Vector[]){
|
||||||
MakeVector(-0.15, -0.065),
|
MakeVector(-0.2, -0.065),
|
||||||
MakeVector( 0.15, -0.065),
|
MakeVector( 0.2, -0.065),
|
||||||
MakeVector( 0.15, 0.065),
|
MakeVector( 0.2, 0.065),
|
||||||
MakeVector(-0.15, 0.065)
|
MakeVector(-0.2, 0.065)
|
||||||
}, 4), 0, 0x1);
|
}, 4), 0, PHYSICS_LAYER_DEFAULT);
|
||||||
|
|
||||||
sprite_set_origin(self->sprite, MakeVector(0.45f, 0.925f));
|
sprite_set_origin(self->sprite, MakeVector(0.45f, 0.925f));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue