How to make a 2D autoscrolling level
Hi,
I want to make a 2D autoscrolling level, where player's movement would be limited on the X axis (-4,4) but he would still be able to move left or right within this limit and to jump in order to avoid approaching obstacles. My question is how should I tackle this?
I plan on creating a "noodle" level with all the obstacles fixed (or spawning). I already coded player's movement, but I'm not sure how to handle the autoscrolling part. I don't want to set the player in perpetual movement as I think that would clash with the ability to move freely on the X axis. I would set the camera on the player and make the level (parallax background + enemies) move left and make it stop once it reaches the end of the background (or some trigger). Can I do that? If so, how?
Hopefully I'm making some sense. Thanks for you help.
Your answer
![](https://koobas.hobune.stream/wayback/20220612234725im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Scene view, objects disappear when i scoll to near. 5 Answers
Why does only one of my instantiated scripts work? 2 Answers
How do i create a character scroll?? 1 Answer
UI scroll to selection - unityUIExtensions? 1 Answer
Is it possible to use gyroscope to produce a parallax tilt effect in Unity 2D? 0 Answers