windyWin Posted January 14, 2021 Share Posted January 14, 2021 (edited) Hello there, I've been puzzling about this for while now. I know of this concept through old fighting games from the 90s such as Street Fighter etc, using hitboxes or some form of collision. Having a collision follow the player seems like a simple task, but I want to have the collision shape to change with the sprite or having it change depending on which frame its using. I've found that other people in the past have come across a similar problem and have posted on other forums. Going through the phaser 3 docs hasnt really helped me much. I've also seen other forms of melee attack, which might rotate a rectangle to imitate a swinging a sword motion. I want to have a go at implementing something that involves collisions frame by frame of an animation such as in 90s fighting games that I grew playing as a kid. This link here refers to a post of someone having a similar problem. Here was tool called LailaSprite that Shadoworker made to handle collisions with sprite animations. It seems worth a look, but not sure if its up to date. I've been using Phaser 3, and have learnt a lot through the framework. I don't have any running code. aside from other projects and things I've been learning. I've watched this problem be easily solved in other software such as Godot, but that has a animation editor that can help handle that. I don't have the understanding of how to accomplish it in Phaser 3 by any means. I'm hoping I can have a discussion on this. I would really appreciate any suggestions or help, or any thoughts from anyone who have accomplished this. Thanks. Edited January 14, 2021 by windyWin Link to comment Share on other sites More sharing options...
piotr Posted January 18, 2021 Share Posted January 18, 2021 (edited) Here's a post that explains how to call a function on the last frame of an animation. For your specific case you could start with a disabled collider (say on a sword) and then once the attack animation is complete, enable it. Edited January 18, 2021 by piobug Link to comment Share on other sites More sharing options...
piotr Posted January 25, 2021 Share Posted January 25, 2021 @windyWin If you are still interested in this topic, I've found and posted a solution on Discourse: https://phaser.discourse.group/t/solved-posted-with-code-enable-disable-hit-boxes-once-per-animation-frame/8712/12 Link to comment Share on other sites More sharing options...
Recommended Posts