How do I make the camera stop following the player if it overtakes the wall

I making a game similar to a hollow knight, and I need the camera stop if to go too far from the wall(stop following the player). I want to give the player a sense of immersion and with the camera leaving much of the limits of the scenario it gets complicated. I appreciate if you can help me.

I belive this text is very confusing, fault of google translator :slight_smile:

1 Like

I’m not clear on what you’re after, but hopefully the “Center the camera on an object within limits” action may be of use to you?

Maybe I understand what you mean.
you can do it in two ways:

  1. put a condition in which when the player moves too far (i.e. XXX pixels) from an object, the camera no longer follows the player, but stops aiming at a fixed object or a certain position (x, y)


  1. put an invisible sprite that when it collides with the player, the camera no longer follows the player, but stops to point to a fixed object or a certain position (x, y)

Between the two options depends on how you are setting up the game.

Attention, however, if in your code the function of the camera following the player is placed in the (parent root), then it will always return to point the player: you should put the camera under the condition of a variable. If you give me the email I will send you a simple example that I have already done for another GDevelopper

praticamente una cosa simile…

I believe I understand your example, but where do I find these components you used called camera0 and camera1?

they are “text sprites” … irrelevant for the “camera” discourse. the camera setting is given only by the scene variable on the left side (camera = 0 … 1 … 2) and by the corresponding camera settings on the right side (change the X position of camera …). However, if you read the GDevelop Wiki for the camera speech, you will see that it is very intuitive.

1 Like