Allow `this.physics.world.wrap` wrapping with an additional y axis padding parameter
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 40.3k
- Forks
- 7.2k
- PR merge metrics
- No merged PRs in 30d
Description
When I want to wrap a sprite at the screen this way:
[.....==>]
[...........=]
[..............]
[ >.........]
[=>.......]
[==>....]
(and the same for up and down)
This is currently not possible (unless your width + height are equal).
For example to wrap as I want it to work on X I can do it like this: this.physics.world.wrap(this.test, this.test.getBounds().width / 2); But then this won't work on the Y Axis.
The solution:
A third optional parameter. Like so:
this.physics.world.wrap(gameObject, paddingX, paddingY)
gameObject = game object, group or array of game objects
paddingX = optional x padding, default 0
paddingY = optinal y padding, default paddingX
If approved I would like to contribute and try to implement it.
BR Geralt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/physics/arcade/World.js at the linked wrap implementation and read how the current padding value is applied on both axes. Verify the requested API shape: paddingY is optional, defaults to paddingX, and supports separate vertical wrapping; done means existing calls still work while unequal X and Y padding work as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100