So what i am trying to do is make a 2 player, well test of movement. i am trying to have one ball controlled by client one upload its x & y everytime it entersframe, and the the client 2 take down those cords and move a movieclip of the same size and color to them.
(Just working with client 1, same thing as 2 just diffrent number in the variable.)
Here is the movieclip to be controled.
onClipEvent (enterFrame){
//Movement
//-----------------------------------------------------------------
//-----------------------------------------------------------------
//on key press move left
if (Key.isDown(Key.LEFT)){
_x -= 10;
}
//on key press move right
if (Key.isDown(Key.RIGHT)){
_x += 10;
}
//on key press move down
if (Key.isDown(Key.DOWN)){
_y += 10;
}
//on key press move up
if (Key.isDown(Key.UP)){
_y -= 10;
}
//Send and recive server stuff
//--------------------------------------------------------------------
//--------------------------------------------------------------------
rec = new LoadVars();
myData = new LoadVars();
myData.ball1x = this._x;
myData.ball1y = this._y;
//send ball1x & ball1y
myData.sendAndLoad("PHP.php", rec, "POST");
}
And this is the second movieclip controled by the variables on PHP.
onClipEvent(enterFrame){
//load variable ball2x
//load variable ball2y
//move to new location x
this._x += (ball2x - this._x);
//move to new location y
this._y += (ball2y - this._y);
}
The problem is i cant fiqure out how to load the variables form the PHP to move the second movieclip.
Here is the PHP.
<?php
$ball1x = $_POST['ball1x'];
$ball1y = $_POST['ball1y'];
$ball2x = $_POST['ball2x'];
$ball2y = $_POST['ball2y']:
print ="ball1x=$ball1x&ball1y=$ball1y&ball2x=$ball2x&ball2y=$ball2y";
?>
What should i use to get the variables ball2x and ball2y?