diff --git a/game/src/Player.c b/game/src/Player.c index 28c50ad..06265ac 100644 --- a/game/src/Player.c +++ b/game/src/Player.c @@ -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));