inventory type thing

This forum is currently in read-only mode.
From the Asset Store
Template for maintaining an inventory with crafting possibilities. Completely documented in text and video.
  • <img src="http://i253.photobucket.com/albums/hh57/alspal/menu.png">

    This is basically my menu thingo, each cell is a value.

    When my variable equals the same as the cell value, the cell is selected (shows as '2' in the picture).

    This is what I'm doing for moving down the menu ( in the first column):

    -Down is pressed         |     
        -Value >= 1          |    Add 1 to value
        -Value <= 4          |
            -Value = 5       |    Set value to 1 
    
    [/code:2x13z7np]
    
    And a similar thing for moving up, except subtracting 1 from value.
    
    This works fine, however I'm having trouble moving left/right
    
    I've tried something like this (for moving right in the first row of the menu):
    
    [code:2x13z7np]
    -Right is pressed      |     
        -Value = 1         |    Add 4 to value
        - OR               |
        -Value = 5         |    
        - OR               |   
        -Value = 9         |
             -Value = 13   |    Set value to 1
    [/code:2x13z7np]
    
    However it doesn't always seem to work right. Is there a different/better way to code something like this?
    
    .
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wouldn't it be easier if you used two values, one for the x position and one for the y? That's how arrays work, which look a lot like what you're making.

  • Could you post the .cap file? Makes it alot quicker to ascertain exactly what's going on.

    Thanks.

  • I might try that idea Arima. The reason they are only a single value at the moment, is cause I'm working with the unique ID of the object, since all the cells are the same object.

    Rich, I'm not sure if I should, its got hundreds of events and they're filled with a lot of crap.

  • YOu could make a 2d array and set values for each 'cells' in the array depending on the values on oyur menu..

    Then when navigating the menus you use the x-y method and then just get the unique id form the object which is found at x,y(where your pointer is at)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)