- Home /
How to stop camera in a 2D game in a certain coordinate.x?
I need to stop the camera to do a fight with the boss in a space game like gradius. How can i do that?
Any help will be apreciated. I've done a lot of things but nothing was useful.
Thanks.
Answer by Vladimir-Shafran · Aug 13, 2014 at 11:47 AM
For game like Gradius you must create a simple parallax effect for your background. And when you wanna stop the camera you need only stop your parallax https://www.youtube.com/watch?v=DIQFhEo1C8c&src_vid Look to the end
Or if you wanna just a stop your camera in some point, you would add needed coordinates on Update. For that create new script from MonoBehaviour for your Camera
void Update()
{
if (isBoss)
{
Vector3 pos = gameObject.transform.position;
pos.x = neededX;
gameObject.transform.position = pos;
}
}
Your answer
Follow this Question
Related Questions
camera script not working 1 Answer
Cinemachine camera shake on button press 0 Answers
Pinch zoom 0 Answers
Camera movement stuttery with interpolate on,Camera movement with interpolate on? 0 Answers