-
How to record movieclip position
Dear Users,
i try to make replay's in simply f1 flash game (car driving on some tracks). I wonder if You be so kind and help me with making replay’s in Flash (like in haxball). Ofcourse i don’t ask for fully soulution. I just ask if You can point me the corect way to make it.
The only idea i have to do replay’s, is to record object (car) position on the track. But with 30fps and f.e. 15 minutes race i will have to get 27.000 data of X,Y position. It's huge information to send :/
Is there any other possibility to make Replay’s?
I will be appreciate for any sugestions.
Regards
AoW
-
Senior Member
you don't have to store every frame. check out splines.
-
Senior Member
p.s.
27.000 data of X,Y position. It's huge information to send
assuming 4 bytes per number, it is 211 KB. way less than typical jpeg image.
-
.
Hi,
No idea how big it would be after 15mins @ 30 fps, realMakc suggests no bigger than a very small image file.
But maybe this may be of some use??
PHP Code:
var TheX = [];
var TheY = [];
function GetPositions()
{
TheX.push(car._x);
TheY.push(car._y);
if (_root._currentframe == _root._totalframes)
{
clearInterval(GetPos);
trace("X-Coords=[" + TheX + "]");
trace(TheX.length);
trace("--------------------");
trace("Y-Coords=[" + TheY + "]");
trace(TheY.length);
}
}
GetPos = setInterval(GetPositions, 33);
-
Senior Member
not quite,
PHP Code:
trace("X-Coords=[" + TheX + "]");
this would be quite large, because every number + its comma could easily be ~20 characters. what I had in mind was ByteArray, where you could use writeFloat() to use 4 bytes per number. then there is compress() to zip all bytes and get it even more compact.
-
Hi again,
i'm back again and trying to save an array of X,Y to php. I made in flash
var arrayexample=new Array();
and
onClipEvent (enterFrame) {
arrayexample[myTimer.getMili()]= [int(track_x),int(track_y)];
}
I can see that in debug mode my arrayexample looks good. But when i'm trying to save this array in php file (i'm using: loadVariablesNummethod in flash, and php:
$data = $_POST['arrayexample'];
$file = "arrayexample.txt";
$fp = fopen($file, "a");
flock($fp, 2);
fwrite($fp, $data);
flock($fp, 3);
fclose($fp);
i get all undefined values and only the last are good.
What i'm doing wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|