I started making a small multi-player avatar chat to start my self with flash and multi-player. Everything worked fine when I was using arrows to move but when I started using the mouse something goes wrong.

Bit more info: When two or more users are connected at the same time and both on the users try to move one user will move and the other will stop in its tracks as the other users data is recived from the server.

EG: User one clicks to move and starts moving. Player two click while player one is in transit. Then player one stops before they reach there desired X,Y and user two carrys on until user one go's to move again.

When using the keys to move all players can move at the same time as there is no need for a loop which im guessing has something to do with the problem.

This is the code: http://pastebin.com/dCanCtP3

  • 1
    \$\begingroup\$ I think you probably need to provide a little more information. What specifically went wrong? What did you expect to happen instead? \$\endgroup\$ – Wesley Petrowski Jan 11 '12 at 22:31
  • 2
    \$\begingroup\$ "Here is my code please fix it" doesn't really come across as a question that looks like you spent any time with it. You'd just have to debug you code when using the keyboard vs using the mouse to see what the problems are. \$\endgroup\$ – Tetrad Jan 11 '12 at 22:48
  • \$\begingroup\$ @WesleyPetrowski sorry about that copied only a bit of what i had posted. Ill add some more information now. \$\endgroup\$ – Louis Jan 11 '12 at 22:56

Every time you receive data, you overwrite your USER, MXX, and MYY global variables. You only store the data for one user at a time, so that is why only one user can move at any one time.

Consider making a class to represent a user and where it needs to move to, and then using an array to store all the users that are currently moving.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.