Search Unity

Scrolling inventory

Discussion in 'Scripting' started by jessee03, Sep 6, 2013.

  1. jessee03

    jessee03

    Joined:
    Apr 27, 2011
    Posts:
    729
    I've been trying to design an old school inventory system similar to pokemon, Final Fantasy, or other old rpgs. The ones where you open up a Menu with mostly just text that you can scroll through and Select items. I can setup a basic list inventory but am unsure how to scroll through the items using just arrow keys and being able to Select and use an item after pressing Enter. The only inventory system I have created has been a icon based inventory so am unsure how to setup this text based one. Any help would be awesome.
     
  2. fire7side

    fire7side

    Joined:
    Oct 15, 2012
    Posts:
    1,819
    Unity isn't set up well for it, but I would say you would want to use labels for each item. You start with a default label which is highlighted with a brighter color. You get input and write a function that moves the highlighted label to the next label when it gets an arrow key. You keep track of which label is highlighted with something like var currentLabel and you write functions for each label for when enter is pressed to do what you intend. So each label variable has a nextLabel and a priorLabel and a function to do something if enter is pressed, which would make a class or a struct, or some other way if those aren't familiar to you. Perhaps matching arrays of variables or whatever.
     
    Last edited: Sep 6, 2013
  3. tonyd

    tonyd

    Joined:
    Jun 2, 2009
    Posts:
    1,224
    cow_co likes this.
  4. jessee03

    jessee03

    Joined:
    Apr 27, 2011
    Posts:
    729