Forum ActionScript 3.0 movement bugg

Problems and discussions relating to ActionScript 3.0 here.

movement bugg

Postby avol » October 9th, 2010, 10:04 am

Hey there,

I'm having a little problem here with moving stage children. All children are moved by x and y numbers. (example: 0,1234 - double), although function looks right and all stage childs should be moved by the same x,y numbers, they are moved differently.

game link: http://r.playerio.com/r/stickmafia-1nectry6eugoywptbh1eka/game.swf

open 2 windows of game instance, and move one character to corner of map with arrow keys and mouse direction.
Then check how it is displayed in other game window for other player. They differ. I rechecked all client-to-server x,y numbers. They are same both in server and client when they are broadcasted.

here's the function I use to move chars, x and y are calculated by mouse and char degree:

Code: Select all
      public function movePlayer(__x,__y, playerName)
      {
         if (playerName == __storage.getMyName())
         {
            var allow_move;
            for (var k =0; k < __stage.numChildren; k++)
            {
               allow_move = true;
               for each (var o:Object in __storage.getUnmovables()) {
                  if (__stage.getChildAt(k).name == o.name)
                  {
                     allow_move = false;
                  }
               }
               if (allow_move == true)
               {
                  TweenLite.to(__stage.getChildAt(k), 0, {x:String(__x), y: String(__y)});
               }
            }
         }
         else
         {
            TweenLite.to(__stage.getChildByName(playerName), 0, {x:String(-__x), y: String(-__y)});
         }
      }
avol
 
Posts: 11
Joined: July 24th, 2010, 11:00 pm

Re: movement bugg

Postby avol » October 10th, 2010, 2:09 pm

fixed the problem, dunno if it was a packet loss or something. I just added a check to send movement packet not more than once every 0.1
avol
 
Posts: 11
Joined: July 24th, 2010, 11:00 pm

Re: movement bugg

Postby Oliver » October 11th, 2010, 10:59 am

:D
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am


Return to ActionScript 3.0