I want to make my camera follow the player ONLY when the player is on solid ground [2D]
TL;DR (Too Long; Didn't Read for those who don't know) will be the bolded text
So far I have my camera following the player at all times. However with how high the player jumps and how quickly they fall, it moves the playing field out of view and can look generally bad. My solution is that I want to make the camera follow the player only when they are standing on an object that has the "ground" tag. To make my question/problem more concise: I want the camera to follow the X-axis at all times but if the player jumps, the camera doesn't move up or down until the player should land on ground again. Think about the impossible game, when the player jumps, the camera doesn't move until the player lands on ground or another black square. Here's a link if you don't know the game. But back to my question: Would i achieve this by fixing the camera to the player and only raising the camera when the player is grounded, would I set the camera to only go up or down when the player hits a certain height on the screen, or is there another solution that I'm not seeing? Thank you in advanced for any help you may provide!
Is it possible that the camera is on an automatic track and doesn't just follow the player or am I just over(under)thinking it?
Answer by cryptichints · Aug 10, 2017 at 08:08 PM
So here's what I found:
In this video, I found the exact camera follow that I want. The problem is that he uses a lot of controls and modules I don't have. My character automatically moves right and never has to worry about a left or right camera shift. My project also only has a jump command so it doesn't need all of the classes/intricacies that his needs. However the way his camera moves is perfect.
In this video, it's another form of moving the camera with screen boundaries where the screen won't move past a certain point. In a sense i suppose that's kind of what I want however the camera is locked on to the player and thus I'm back to my original problem.
So my question is: is there a way to get the results of the first video, with the simplicity of the second one?
Your answer
Follow this Question
Related Questions
Changing gravity depending on character/camera rotation 0 Answers
I want to make my camera follow the player ONLY when the player is on solid ground [2D] 0 Answers
2D platformer: how to stop camera at the end of the map? 0 Answers
Is there a way to smoothly change a float number between two numbers when a key is pressed? 1 Answer