Comments (5)
Thanks for the answers, i just need to use getPosition method.
from grid-engine.
Hi @borkowsky, I assume you mean that the moveLeft
, moveRight
, etc. methods?
They always return undefined on purpose.
What do you suggest them to return instead?
from grid-engine.
Hi @borkowsky, I assume you mean that the
moveLeft
,moveRight
, etc. methods?
They always return undefined on purpose.
What do you suggest them to return instead?
Maybe return new position?
from grid-engine.
The problem is, that they are not synchronous methods. You can see them more as a "fire and forget" command.
A good comparison would be to see them like a keypress in a game. You can press the key as often as you want and the game will notice, but it will decide whether or not a keypress is changing the player position or not.
In this plugin it is as follows: if you take a look at the "move-player" example you see that a pressed key will trigger a call to on e of the move
methods on every update. But not each of these calls causes a position change. They only tell the game that you would like to move a player.
Therefore it is not possible to return a new position. But if you tell me what you need it for, I can maybe tell you how to achieve this differently. And if not possible, I could extend the plugin in a way that helps you and other users.
Since Version 1.4 there are some observables that you can use to react to events like movementStarted
, movementStopped
or directionChanged
.
from grid-engine.
You're welcome. I am playing with the thought of adding an observable that fires on every position change. Depending on your use case that could prevent you from polling.
from grid-engine.
Related Issues (20)
- 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
- Add option to `follow` to allow immediate movement
- Question about "Tiled Editor" and collisions. 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.