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