Limit to scrolling

Hello , i need help with scrolling verticaly in my game .
So i have my scene where my vertical scrolling is. I have a level selection but i need to fit more (with a touch scrolling event) , so here are my events :

Its working , but i have a problem. I want it to have a limit , where it cant scroll further . So the camera doesnt go to no where. A limit where the camera stops scrolling ,can anyone help?

Check where the camera is positioned. If it’s outside your boundaries/limits, then set the position to the boundary/limit.


Ok thanks , but i dont know where to put that event ive been struggling a lot so can you explain more in depth maybe?

Sure. Here are 2 examples of how you can handle the camera going past a maximum camera value (held in a scene variable named maxCameraY).


An alternative, that is works on what you’ve already got in place, is:

You can implement something similar for the camera passing the minimum camera value.

Do i need to set the maxCameraY variable somewhere in my scene first in order to do this because its not working for me , i understand the process but it doesnt work.

Yes, you need to set the value of maxCameraY. Do this either when you define the variable in the editor, or in an event with a “At the beginning of the scene” condition.

Done! I solved it , thanks for all the help!