Using bitmaps to handle collision with a sword?

So, I’m working on an isometric hack’n slash and I want swords to hurt enenies.

As far as I understand, this means that I need to

  • create a Zone that overlaps with the character’s sword;
  • for each of the 8 directions of the character
    • for each hitting frame in each of these directions
      • activate my sword Zone
      • adjust x, y, width, height and rotation of sword Zone to match position of sword in the sprite
  • for each non-hitting frame
    • deactivate my sword Zone

Now, I haven’t written games in a long time, but I seem to remember a (simpler?) trick that involved:

  • having a second sprite sheet with the same frames as the character’s animations but in which only collision zones (so, basically the outline of the rectangle) were drawn;
  • using this sprite sheet for collision detection instead of bounding boxes.

Is this possible with Phaser? Are there drawbacks?

I think so, see something similar in

1 Like

Yep, definitely looks related. I don’t quite see how to go from one to the other yet, but I’ll get there :slight_smile:

I’m getting somewhere with this :smiley: