Taking Directional Damage

  • Thinking about how some of my games operate, I was wondering how to go about implementing directional damage. The example being whether the player is being hit from the front or from behind.

    I'm not sure how I would create this since the player sprite can be considered facing left or right. And with 8 direction behavior, you would have front and back depending on the direction the player was facing.

    Any ideas on how this could be done would be appreciated.

  • What exactly do you mean by "directional damage" ? Do you mean Knockback?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm guessing different amount of damage, depending on whether the bullet hit from the front or from behind?

    You can use angle() and anglediff() expressions.

    Something like this:

    Bullet on collision with Player
       If anglediff(Player.angle,  angle(Bullet.x, Bullet.y, Player.x, Player.y))<45   // player hit from behind
       Else  // Player is facing the bullet
    [/code:cmjqbzrs]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)