feat: PlayerAttackInput is now PlayerJabInput, added PlayerHeavyInput
This commit is contained in:
parent
aca01507ed
commit
95f5bcfee7
|
@ -38,9 +38,18 @@ impl_PhysicsEntity_for(Player,
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void Internal_PlayerInitInput(Player* self) {
|
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,
|
||||||
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_S, SDL_SCANCODE_W)), (InputDelegateFn)PlayerVerticalInput);
|
CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_A, SDL_SCANCODE_D)),
|
||||||
playerinput_add(self->playerInput, KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), (InputDelegateFn)PlayerAttackInput);
|
(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() {
|
Player* MakePlayer() {
|
||||||
|
@ -125,7 +134,12 @@ void PlayerVerticalInput(Player* self, InputEvent value) {
|
||||||
self->moveInput.y = -value.as_float;
|
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)
|
if(value.as_bool)
|
||||||
self->attackInput = 1;
|
self->attackInput = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ void DestroyPlayer(Player* self);
|
||||||
|
|
||||||
void PlayerHorizontalInput(Player* self, InputEvent value);
|
void PlayerHorizontalInput(Player* self, InputEvent value);
|
||||||
void PlayerVerticalInput(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 PlayerStart(Player* self);
|
||||||
void PlayerUpdate(Player* self, float deltaTime);
|
void PlayerUpdate(Player* self, float deltaTime);
|
||||||
|
|
Loading…
Reference in a new issue