Hi guys, I’m stuck with this problem, I wish the camera was moving like in this game [youtube][1]
The idea is simple, the camera only goes up and down and the spaceship moves in a specific area.
For now I am only able to change the angle, sadly the camera follows the spaceship in all directions (up,down,left,right)
I used the camera of tutorial.
So how can I restrict the movement of the camera?
Thanks, and sorry for my english ^^
You need to move your ship based on camera, not the inverse.
Something like: Camera.X += 100 (thick) for constant side scrolling.
Then, You need to update your ship position with camera
Something like: Ship.X = Ship.OffsetX + Camera.X where Ship.OffsetX = The movement on Screen.
Then you need to adjust the Camera.Z with your Ship.Z position.
Obviously, you need some verifications on screen bounds, to accelerate camera, or decrease speed (Camera.X += ???), and make camera Up and Down when you reach top and bottom screen borders.
Your arrows keys, need control the Ship.Offset vector.