Comments (3)
Update: it seems that calling setOrigin(0.5)
on the sprite in update()
serves as a workaround, although that might not be optimal!
from grid-engine.
Hey @iUltimateLP, happy to hear you like Grid Engine.
I know why your problem happens, but I am not sure about the best way to solve it.
Grid Engine sets the origin to (0,0). It needs to know the origin in order to place the sprite correctly to the center of the tile. I think it would not be a problem to change the origin to something else, but then someone who wants to have an origin of (0,0) has the same problem you experience now.
The first solutions coming to my mind would be:
-
Grid Engine could store the original origin and only set its own one for repositioning the sprite and then set the old origin afterwards again (basically what you are doing as a workaround right now). The fact that your workaround works, is an indicator that this solution should work.
-
Let Grid Engine detect the origin and calculate the positioning of the sprite in relation to the origin.
I tend to favor option 1 over 2, because 2 is probably more complex.
I am also open for more ideas.
from grid-engine.
I tried resetting the origin after applying the pixel position changes but it leads to a wrong positioning of the sprite. I can't see a better solution than your workaround in cases where you need an origin different from (0,0).
I will close this for now but feel free to reopen if you have more suggestions.
from grid-engine.
Related Issues (20)
- Upgrade phaser version to 3.70
- "Tile Costs for Pathfinding" example has errors in console
- HeightShift does not work correctly for isometric maps
- Depth sorting is wrong for characters using containers
- Show warning if char layer was not found.
- Cache container height
- pipeline "Light2D" does not work correctly HOT 7
- Improve pathfinding performance for multi-tile characters HOT 3
- Example dots HOT 1
- Jump point search algorithm is broken for maps with 8 direction movement and partial blocking HOT 2
- Got IDE error message HOT 2
- Rework JPS pathfinding algorithm
- Cancellable movements
- Surface more MoveTo options for following
- Update to latest phaser version 3.80
- Wrong pathfinding warning for algorithms other than JPS
- Possible to cleanup and create new grid engine when switching tilemaps? HOT 2
- FacingDir and ignoreBlockingTarget pathfinding/follow options are broken for multi tile characters
- Repeatedly calling `follow` leads to stop
- moveTo vs findShortestPath HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grid-engine.