feat: updated jump and air heavy attacks,
This commit is contained in:
parent
888fb3e383
commit
f30902e8c9
|
@ -158,21 +158,16 @@ const State* PlayerKickA_Update(Player* self, float deltaTime) {
|
||||||
return PlayerKickA();
|
return PlayerKickA();
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
const State* PlayerAir_Update(Player* self, float deltaTime) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PlayerJump_Enter(Player* self) {
|
void PlayerJump_Enter(Player* self) {
|
||||||
if(self->jumpInput) {
|
if(self->jumpInput) {
|
||||||
self->currentAnimation = self->jump;
|
self->currentAnimation = self->jump;
|
||||||
self->verticalVelocity = 2.f;
|
self->verticalVelocity = 3.f;
|
||||||
}
|
}
|
||||||
animation_sprite_play_from(self->currentAnimation, 0.f);
|
animation_sprite_play_from(self->currentAnimation, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
const State* PlayerJump_Update(Player* self, float deltaTime) {
|
const State* PlayerJump_Update(Player* self, float deltaTime) {
|
||||||
self->verticalVelocity -= 3.f * deltaTime;
|
self->verticalVelocity -= 5.f * deltaTime;
|
||||||
if(self->height == 0.f) {
|
if(self->height == 0.f) {
|
||||||
self->verticalVelocity = 0.f;
|
self->verticalVelocity = 0.f;
|
||||||
return PlayerIdle();
|
return PlayerIdle();
|
||||||
|
@ -196,9 +191,7 @@ const State* PlayerAirHeavy_Update(Player* self, float deltaTime) {
|
||||||
};
|
};
|
||||||
const float ntime = animation_sprite_get_time_normalized(self->currentAnimation);
|
const float ntime = animation_sprite_get_time_normalized(self->currentAnimation);
|
||||||
size_t frame = sprite_get_tile(self->sprite);
|
size_t frame = sprite_get_tile(self->sprite);
|
||||||
if(frame == 1) {
|
if(frame == 1) PlayerHurtbox(self, damage, MakeVector(0.12f, 0.12f), MakeVector(0.12f, -0.48f));
|
||||||
PlayerHurtbox(self, damage, MakeVector(0.07f, 0.07f), MakeVector(0.3f, -0.38f));
|
|
||||||
}
|
|
||||||
const State* result = PlayerJump_Update(self, deltaTime);
|
const State* result = PlayerJump_Update(self, deltaTime);
|
||||||
return (result == PlayerJump()) ? PlayerAirHeavy() : result;
|
return (result == PlayerJump()) ? PlayerAirHeavy() : result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue