fix: damage is now dealt correctly
This commit is contained in:
parent
b3622ab279
commit
1fbb3b1530
|
@ -1,7 +1,6 @@
|
|||
#include "PlayerStates.h"
|
||||
#include "Player.h"
|
||||
#include "physics_world.h"
|
||||
#include "debug.h"
|
||||
|
||||
static inline
|
||||
void InternalSpriteFlipWithMovement(Player* self) {
|
||||
|
@ -57,8 +56,7 @@ void PlayerAttackTrigger(Player* self) {
|
|||
MakeVector(0.1f, 0.06f), PHYSICS_LAYER_DEFAULT, self->rigidbody);
|
||||
if(found != NULL) {
|
||||
PhysicsEntity entity = collider_get_owner(found);
|
||||
int damage_amount = 10;
|
||||
entity.message_receiver->handle_message(entity.data, 1, &damage_amount);
|
||||
entity.message_receiver->handle_message(entity.data, 1, (void*)1u);
|
||||
}
|
||||
++self->animationTriggers;
|
||||
}
|
||||
|
@ -71,7 +69,7 @@ void PlayerJabA_Enter(Player* self) {
|
|||
|
||||
const State* PlayerJabA_Update(Player* self, float deltaTime) {
|
||||
const float ntime = animation_sprite_get_time_normalized(self->currentAnimation);
|
||||
if(self->animationTriggers <= 0 && ntime > 0.5f)
|
||||
if(self->animationTriggers == 0 && ntime > 0.5f)
|
||||
PlayerAttackTrigger(self);
|
||||
if(self->attackInput && ntime > 1.0f)
|
||||
return PlayerJabB();
|
||||
|
@ -90,7 +88,7 @@ void PlayerJabB_Enter(Player* self) {
|
|||
|
||||
const State* PlayerJabB_Update(Player* self, float deltaTime) {
|
||||
const float ntime = animation_sprite_get_time_normalized(self->currentAnimation);
|
||||
if(self->animationTriggers <= 0 && ntime > 0.5f)
|
||||
if(self->animationTriggers == 0 && ntime > 0.5f)
|
||||
PlayerAttackTrigger(self);
|
||||
if(self->attackInput && ntime > 1.0f)
|
||||
return PlayerJabA();
|
||||
|
|
Loading…
Reference in a new issue