Author Topic: How to recognize a headshot  (Read 1110 times)

sakurati

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
How to recognize a headshot
« on: Wed, Oct 13, 2010 »
How can one recognize a headshot for a sprite.
Can this be done by using just one sprite?

rolandinho

  • Member
  • **
  • Posts: 39
  • Karma: +0/-0
    • View Profile
    • My Portfolio
Re: How to recognize a headshot
« Reply #1 on: Wed, Oct 13, 2010 »
one way would be to compare the Y value of the Bullet to the Y value of the target and calculate where the hit was before killing both.

But there are other ways for sure.

abmurray

  • Member
  • **
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: How to recognize a headshot
« Reply #2 on: Thu, Oct 14, 2010 »
create a helper sprite that's roughly the size of your character's head

adjust its offset so that it's aligned correctly

make sure it matches the character's position on every frame

check to see if any bullets overlap the head helper -- if so, boom, headshot, etc

Richard Kain

  • Active Member
  • ***
  • Posts: 231
  • Karma: +0/-0
    • View Profile
Re: How to recognize a headshot
« Reply #3 on: Fri, Oct 15, 2010 »
Technically, you wouldn't even need to use a FlxSprite for the head. Just add an extra FlxRect to the character's FlxSprite, and update the location relative to the character's origin.

sakurati

  • Member
  • **
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: How to recognize a headshot
« Reply #4 on: Wed, Oct 20, 2010 »
thanx a lot, will use that