Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How To Make Background Scroll Up?

Discussion in '2D' started by Dogg, Aug 28, 2014.

  1. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    Hi. I've created a scrolling background before, but it scrolled sideways and the Player could only move sideways. I want to make the background scroll up and continue to scroll up when the Player moves up. Now you may be thinking, "why don't you just move the background and not the Player?" Well it has to do with how my game plays, the control and everything. Anyways so how can I do this? I was thinking when the Player moves to a certain position that the background would change position or a second one would come in a go to the top. That way it would repeat over and over again. Or create a separate camera from the main camera and have it and the texture/sprite stay still but still be able to see it on the main camera(the actual game). Not sure what to do here hehe... So any help is appreciated. :)
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Can you just scroll the texture by modifying the texture offset Y value?
     
  3. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    Not sure how to do that exactly. I'll look into it though.
     
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    in the material.
     
  5. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    Well I mean't through the script, not like directly through the material. But again I'll try to figure it out.
     
  6. Vitor_r

    Vitor_r

    Joined:
    May 23, 2013
    Posts:
    93
  7. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
  8. Pyrian

    Pyrian

    Joined:
    Mar 27, 2014
    Posts:
    301
    Wait, you have done it horizontally? Why not just replace the x with y?
     
  9. Dogg

    Dogg

    Joined:
    Mar 5, 2014
    Posts:
    203
    Well I don't mind right now because all I'm trying to do is get a background to scroll and stay in the background, without going out of screen when the Player decides to fly higher. It actually it could work if i had a follow script. To where the background follows the main camera. Except that the main camera is attached to the Player so that wouldn't work because then the background would be changing positions all the time. Maybe if the Main Camera itself had a follower script, then it could work. Not sure what to do here. I want the main camera to just go up, but so far it follows the Player wherever he/she goes.
     
  10. hodx

    hodx

    Joined:
    May 11, 2013
    Posts:
    16
    make a boundry collider to keep in bounds