diff options
Diffstat (limited to 'src/player.c')
| -rw-r--r-- | src/player.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/player.c b/src/player.c index 05d3546..7d41b57 100644 --- a/src/player.c +++ b/src/player.c @@ -80,6 +80,7 @@ void HandleAttack(Entity* player) { } Sprite* bodySprite = &player->sprites[player->bodySpriteIndex]; + player->numHitBoxes = 1; if (bodySprite->animations[PLAYER_ATTACK].isComplete) { player->state = PLAYER_IDLE; @@ -110,9 +111,16 @@ void FlipBody(Entity* player) { Sprite* bodySprite = &player->sprites[player->bodySpriteIndex]; if (player->velocity.x < 0) { + bodySprite->flipX = true; + player->hitBoxes[0].x = HITBOX_XPOS_FLIPPED; + + } else if (player->velocity.x > 0) { + bodySprite->flipX = false; + player->hitBoxes[0].x = HITBOX_XPOS; + } } @@ -135,10 +143,13 @@ void AddPlayer(float xpos, float ypos) { player.flags |= (ENTITY_PHYSICS_ACTIVE | ENTITY_VISIBLE); player.physicsCollider = physicsCollider; + player.hitBoxes[0] = punchHitBox; + player.numHitBoxes = 1; - #ifdef BEATEMUP_DEBUG - player.physicsColliderColor = RED; - #endif +#ifdef BEATEMUP_DEBUG + player.physicsColliderColor = RED; + player.hitboxColors[0] = BLUE; +#endif AddPlayerSprites(&player); AddEntity(&player); |
