-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Deprecate screenCenter(), add gameCenter() and viewCenter() #3310
base: dev
Are you sure you want to change the base?
Conversation
this is all good but I'm not gonna add this to the 5.9.0 release as we need to update all the documentation, demos and snippets, first |
Actually we need to also update the unit tests, first. Should also add a separate test for |
oh ok, so i guess it will be merged in 6.0.0? |
changed my mind, I need to edit a bunch of demos for 5.9.0 already, so this is now on 5.9.0 |
Sorry, changed my mind again, I'm not sure I'm happy with these names, and I think there's other issues, involved here. I'm leaning now, towards For now, screenCenter is used a ton, and deprecating it at the last second is gonna impact a lot of projects, when most people are using it just to center something on a ui screen, and there's already plenty of deprecation in 5.9.0. So this will either go to 5.10.0 or 6.0. in the future we're planning on having colliders and images be a component of FlxObjects and FlxSprites, so maybe it makes sense to do |
I would also kinda like a sprite.centerTo(otherSprite) or different function names to center a sprite on top of another sprite |
I've been thinking about that too, but that might be better as a static extension, and it has the same issue of confusing collider width/height with graphic width/height For now I recommend doing the static extension yourself import flixel.FlxObject;
import flixel.utils.FlxAxes;
class AlignTools
{
static inline function centerOn<T:FlxObject>(objA:T, objB:FlxObject, axes:FlxAxes):T
{
if (axes.x) objA.x = objB.x + (objB.width - objA.width) / 2;
if (axes.y) objA.y = objB.y + (objB.height - objA.height) / 2;
return objA;
}
} |
Closes #3309