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)});
}
}