-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
coreCore logic module of the frameworkCore logic module of the frameworkenhancementNew feature or requestNew feature or requesthigh priorityMust be completed as soon as possibleMust be completed as soon as possible
Description
FlixelObject currently uses a custom physics model (velocity, acceleration, drag, updateMotion(), etc.). The goal is to integrate libGDX’s Box2D via an interface so any subclass (e.g. FlixelSprite) can opt in to Box2D without a separate base class. Implementors get methods like getBody(), createRectangularBody(), etc., with default implementations where possible to reduce boilerplate.
Requirements:
- Add
gdx-box2dto the core module (inflixelgdx-core/build.gradle). - Provide an interface (e.g.
FlixelBox2DObject) with:- Body
getBody()(orOptional<Body>if body is created lazily). - Convenience defaults (e.g.
createRectangularBody(World world)and optionallycreateRectangularBody(World world, BodyDef def)/ fixture helpers) that create a body from the object’s currentx,y,width,height, and a documented pixel-to-meter scale, and store it sogetBody()returns it. Other helpers (e.g. apply velocity/forces in terms of existingvelocityX/velocityYsemantics) can be default methods where it makes sense.
- Body
- Do not introduce a dedicated
FlixelBox2DSprite(or similar) base class. A dev should be able to extendFlixelSprite(orFlixelObject), implementFlixelBox2DObject, and optionally override defaults. - Document (and implement in defaults where applicable) that implementors must sync Box2D body position/angle back to
FlixelObject’sx,yandangle(using the same pixel-to-meter scale). If an implementor usesupdateMotion(), they can delegate to the world step and then sync from the body instead of the current custom integration. - Create a global
Worldobject inside ofFlixelGame. This is where every object that implements this new interface should be updated. When implemented, there should be static helpers in theFlixelmanager class (such assetGravity(float gravity)for example).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreCore logic module of the frameworkCore logic module of the frameworkenhancementNew feature or requestNew feature or requesthigh priorityMust be completed as soon as possibleMust be completed as soon as possible
Projects
Status
🗒️ Todo