Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

2D Vertical Scrolling Backgrounds (Football Field)

Discussion in '2D' started by kingjavo, Jul 9, 2015.

  1. kingjavo

    kingjavo

    Joined:
    Feb 3, 2014
    Posts:
    17
    Hi, I'm in the process of starting to build a game like "Touchdown Hero" for mobile phones and tablets. The first thing I'm trying to decide on is the best method for getting the field to scroll vertically.

    I don't have my artwork yet and the assets are limited on the Unity Asset Store, minus a football field material for $2. I've watch the 2D Scrolling tutorial and picked up on some ideas, but my problem is this... there are let's say 20 fields and they scroll randomly with weather and all.

    What would be the best way to handle this to get me started?

    Thx in advance! :)

     
  2. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Would the weather change during the game or is it constant once the game starts? E.g. Are there 10 different fields each in sun & rain making the 20 or are there 20 different fields that then each have weather variants?
     
  3. kingjavo

    kingjavo

    Joined:
    Feb 3, 2014
    Posts:
    17
    I bought a weather particle asset from the Asset store and plan to have the weather drawn randomly. Not sure if the field background can randomly have leaves or snow on the surface as well or those backgrounds need to be created separately as independent objects.

    Thx for the help.
     
  4. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    My advice would be to start by just doing one field, get your scrolling & other assets working how you want it to so you can test everything works before you add the other fields & weather. Once you know how to do it with one field it isn't much work to add more as they will all work the same way, just look different.
     
    theANMATOR2b likes this.
  5. kingjavo

    kingjavo

    Joined:
    Feb 3, 2014
    Posts:
    17
    That's my plan, but I know you can be more efficient with your code and not create x number of backgrounds for a vertical scrolling game. I'm just trying to find out what's the more efficient way to do it.
     
  6. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    If you have a finite playfield, then using one background and scrolling over it using whatever camera code you need is fine.

    To change the look of the playfield, you can change the texture applied to it. To simplify the number of textures you are using, you can adjust the material's parameters at runtime. You could try to adjust the Albedo color:
    Albedo-Color.jpg

    This could make grass look different depending on the situation. You can also overlay an additional texture or perhaps find a use for the secondary maps to add different details to the background on the fly...
     
    theANMATOR2b likes this.
  7. kingjavo

    kingjavo

    Joined:
    Feb 3, 2014
    Posts:
    17
    Thanks for the reply Adam. Is there a thread or tutorial you could point me to on how best to do this? I'm also thinking of using a sprite instead of a quad as the background object, but wasn't sure if that would be best.
     
  8. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    I would try looking on the asset store for the tower bridge 2d platformer project to break that down. Also go through the 2D section on the learn site to see how to set up a 2D game.
     
  9. kingjavo

    kingjavo

    Joined:
    Feb 3, 2014
    Posts:
    17
    Are you referring to this game?
    http://peetlee.com/portfolio/2d-platformer-tower-bridge-defence/

    I think I've seen it as part of the 2D tutorials, but it's not mobile and not a side scroller. Am I missing something?
     
  10. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664