#How async work?

5 messages · Page 1 of 1 (latest)

prime gyro
#

not sure if this answers your question but

#

It looks like the issue with your code is that the while loop in the movePlayer function never ends, so the player will continue to move indefinitely. This is because the loop only checks the initial value of movement and does not update it based on any new messages that are received.

#

To fix this, you can use the onMessage function to listen for new messages and update the value of movement accordingly. You can then use this updated value in the while loop to determine whether the player should continue moving. Here is an example of how you might update your code to do this:

#

This should allow the player to move based on the latest message received, rather than the initial value of movement.