diff --git a/game/src/Player.c b/game/src/Player.c index 40b6599..ac3befc 100644 --- a/game/src/Player.c +++ b/game/src/Player.c @@ -38,9 +38,18 @@ impl_PhysicsEntity_for(Player, static inline void Internal_PlayerInitInput(Player* self) { - playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_A, SDL_SCANCODE_D)), (InputDelegateFn)PlayerHorizontalInput); - playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_S, SDL_SCANCODE_W)), (InputDelegateFn)PlayerVerticalInput); - playerinput_add(self->playerInput, KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), (InputDelegateFn)PlayerAttackInput); + playerinput_add(self->playerInput, + CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_A, SDL_SCANCODE_D)), + (InputDelegateFn)PlayerHorizontalInput); + playerinput_add(self->playerInput, + CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_S, SDL_SCANCODE_W)), + (InputDelegateFn)PlayerVerticalInput); + playerinput_add(self->playerInput, + KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), + (InputDelegateFn)PlayerJabInput); + playerinput_add(self->playerInput, + KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_K)), + (InputDelegateFn)PlayerHeavyInput); } Player* MakePlayer() { @@ -125,7 +134,12 @@ void PlayerVerticalInput(Player* self, InputEvent value) { self->moveInput.y = -value.as_float; } -void PlayerAttackInput(Player* self, InputEvent value) { +void PlayerJabInput(Player* self, InputEvent value) { + if(value.as_bool) + self->attackInput = 1; +} + +void PlayerHeavyInput(Player* self, InputEvent value) { if(value.as_bool) self->attackInput = 1; } diff --git a/game/src/Player.h b/game/src/Player.h index 8e71a18..c607c52 100644 --- a/game/src/Player.h +++ b/game/src/Player.h @@ -46,7 +46,8 @@ void DestroyPlayer(Player* self); void PlayerHorizontalInput(Player* self, InputEvent value); void PlayerVerticalInput(Player* self, InputEvent value); -void PlayerAttackInput(Player* self, InputEvent value); +void PlayerJabInput(Player* self, InputEvent value); +void PlayerHeavyInput(Player* self, InputEvent value); void PlayerStart(Player* self); void PlayerUpdate(Player* self, float deltaTime);