question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setTilePosition issue

See original GitHub issue

Hi 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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Annoraaqcommented, Apr 28, 2021

I just released version 1.13.0 that should implement the desired behaviour via setPosition() method and also fixes stopMovement(). Let me know if that solves your problem 😃

1reaction
Mteuahasancommented, Apr 28, 2021

That totally solved it ! Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Moving error · Issue #109 · Annoraaq/grid-engine
Hi. Sometimes when i try to move character after create scene, char just change facing direction and not move. How can i fix...
Read more >
Phaser 3 API Documentation - Class: TileSprite
If you notice it and it becomes an issue, the only way to avoid it is to ensure that you provide POT textures...
Read more >
Set Tile position in TileContainer
I am trying to modifiy the tiles position from Center to Top-Left inside a TileContainer in order to do this I have a...
Read more >
Fixing Sizing in Spritekit
I am creating an app in SpriteKit using C# on Xamarin, and I am trying to position "Tiles" correctly on a 1024x768 scene....
Read more >
setTilePosition - Phaser 3 API Documentation (beta)
The y position of this sprite's tiling texture. Returns: Description: This Tile Sprite instance. Type:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found