hi everyone!
I’ve got a little camera problem…
I’m making this fighting game where the player can move around on the screen, But the camera ALWAYS shows the 2 players on the screen… So… If Player1 and Player2 are right next to each other… the camera zooms in…
But when Player1 moves away… the camera zooms out… but still keeps player1 and player2 on screen…
This is what i’m using now to try and achieve the effect i want…
onClipEvent (load) {
_root.OxCamera = _root.Camera._xscale;
_root.OyCamera = _root.Camera._yscale;
}
onClipEvent (enterFrame) {
_root.P1and2Dis = _root.P2._x-_root.P1._x;
_root.Camera._x = _root.P1._x+(_root.P1and2Dis/2);
_root.CamScale = (Math.sqrt(_root.P1and2Dis*_root.P1and2Dis));
if (_root.CamScale>700) {
_root.Camera._xscale = _root.OxCamera-_root.CamScale;
_root.Camera._yscale = _root.OyCamera-(_root.CamScale*.8);
} else if (_root.CamScale<700) {
_root.Camera._xscale = _root.OxCamera;
_root.Camera._yscale = _root.OyCamera;
}
}
I’ve included the .swf file so it’s easier to understand what i’m trying to do…
Use the ARROW KEYS to move the square on the left … well… left and right
The Camera will follow them… But I can’t seem to get the zoom in and out right…
What can i do to solve this?
Thanks again!