Smooth Circular Frame Scrolling
I'm trying to make the screen scroll in a way that follows the ball in my latest game. I want it to be able to only scroll a certain distance from the center, and the camera object follows the ball, kind of like a tetherball. So far, I have the angle and distance between the center camera and the ball defined as:
Code:
Always Set ballTrackAngle("camera") to ATan2(currentY( "camera" ) - Y( "camera" ), X( "camera" ) - currentX( "camera" ) )
Always Set ballTrackDistance("camera") to Abs(X( "camera" ) - ballX( "camera" ) ) + Abs(Y( "camera" ) - ballY( "camera" ) )
Always Center Horizontal Display at X=X("camera")
Always Center Vertical Display at Y=Y("camera")
These work, and the code for the scrolling mostly works.
Code:
When Ball is in Play Area: Set X("camera") to ( Frame Width / 2 ) - Cos(ballTrackAngle( "camera" ) ) * 50
When Ball is in Play Area: Set Y("camera") to ( Frame Height / 2 ) + Sin(ballTrackAngle( "camera" ) ) * 50
The problem I'm having is that when the ball gets too close to the camera object, the camera swoops around it somewhat to adjust. A regular swoop is noticeable at lower speeds, around 8-16, but where I need it, at 32+ (currently 50) the screen shakes like CRAZY! That's not exactly where I want my Vlambeer effects. Can anyone point me in the right direction please?
I would post an example but the game has gotten way too big and in-depth to post. :(