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 swordZone
to match position of sword in the sprite
- activate my sword
- for each hitting frame in each of these directions
- for each non-hitting frame
- deactivate my sword
Zone
- deactivate my sword
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?