setTilePosition issue
See original GitHub issueHi there,
I’m facing an issue trying to use the setTilePosition method. Here is the context : I’m making a multiplayer project with socket.io. For this project, I would like Phaser to run even if the browser tab is not focus but it seems to be impossible. So, in order to tackle this, I’m requesting the current position of all players on window’s focus event and then I moveTo my other players. BUT, if I wasn’t focusing the game’s browser tab, when I come back at it, the other players start their movement just now.
I first tried to speed up the other players but I don’t managed to succeed. Then I walked into this issue where the method setTilePosition
is mentioned so I tried this :
gridEngine.gridCharacters
.get(onlineUser.id)
.setTilePosition(
new Phaser.Math.Vector2(
onlineUser.coordinates.x,
onlineUser.coordinates.y
)
)
It seems to be hacky right ? Anyway, this is working randomly.
Looking at the sources, it seems that the method check whether the player is moving so I tried to call stopMovement
before setTilePosition
and I got this error.
Thank you and sorry the issue is quite verbose. Happy to provide more information if needed 🙂
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
I just released version 1.13.0 that should implement the desired behaviour via
setPosition()
method and also fixesstopMovement()
. Let me know if that solves your problem 😃That totally solved it ! Thank you