Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT]: Accurate hitboxes #23

Open
ACrazyTown opened this issue Dec 2, 2022 · 1 comment
Open

[ENHANCEMENT]: Accurate hitboxes #23

ACrazyTown opened this issue Dec 2, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@ACrazyTown
Copy link
Contributor

Currently, FlxAnimate does not have an accurate hitbox (in fact, it does not have a hitbox at all I believe). This can lead to issues with positioning and other stuff dependant on the hitbox.

Describe the solution you are proposing

In theory it should be simple to fix this, although in practice it may not be as simple, depending on how FlxAnimate handles rendering and stuff.

When a frame change happens in an animation, FlxAnimate should get the lowest and highest x and y positions of the currently rendered sprites. From there we have the size of the hitbox and we just need to position it.

I have already attempted to prototype this but tbh I have no idea how FlxSprites hitboxes are created and positioned so my attempt, while working, started dropping FPS because of the goofy method I used to position them.

@ACrazyTown ACrazyTown added the enhancement New feature or request label Dec 2, 2022
@Cheemsandfriends
Copy link
Member

I tried to do this a long time ago, but I lack in knowledge on how to transform mathematically a rectangle with a matrix (Not to mention that you would need to increase the width or height depending on the position of the sprites that are currently in), Not like FlxSprites, which I believe that the only thing they need to check is the rendering width and height of the FlxFrame

I can't promise because I would need to check a lot of vids and math stuff to make the hitbox be decent but I'll see what I can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants