Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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

share|improve this question
1  
I think you probably need to provide a little more information. What specifically went wrong? What did you expect to happen instead? –  Wesley Petrowski Jan 11 '12 at 22:31
2  
"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. –  Tetrad Jan 11 '12 at 22:48
    
@WesleyPetrowski sorry about that copied only a bit of what i had posted. Ill add some more information now. –  Louis Jan 11 '12 at 22:56

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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