Inventory, layer or layout?

0 favourites
  • 13 posts
From the Asset Store
Template for maintaining an inventory with crafting possibilities. Completely documented in text and video.
  • Greetings there! ^_^

    So to make an inventory, i figured a different Layout would fit better - but that resets the layout which u were on when u return back, position and enemies etc.

    So my question is, is the fix for the above hard? Or should one go with a Layer inventory type? Set layer visible/invisible?

    Though wont that lag or so if there are already 100+, objects on the former layers??

    Anyone? ^_^

  • You can set items to global in the properties to have them keep their values when navigating between layouts. Is it a very basic inventory though because usually you would make one with an array and send the data to game rather than make one that is 100% graphics based. You are implying that you are going to start hiding inventory stuff that you're not using. With an array you can create slots and send the item data to game and display the graphics you want without the need to hide anything, although I don't know what your game is so this might not be relevant.

  • You can set items to global in the properties to have them keep their values when navigating between layouts. Is it a very basic inventory though because usually you would make one with an array and send the data to game rather than make one that is 100% graphics based. You are implying that you are going to start hiding inventory stuff that you're not using. With an array you can create slots and send the item data to game and display the graphics you want without the need to hide anything, although I don't know what your game is so this might not be relevant.

    RPG games - it does look like they use a different layer for a full screen inventory - but this resets monsters on other layouts.

    Maybe somehow with an array, but with many slots, this may become a bit hard haha xD

    • Can a zelda type inventory be array?
  • Yes array is what you need to store the items and then display them. It is particularly good when you have a number of items but are also calculating an amount of them, say a number of health potions. You're right that it can go to a different layout, or you can display a hidden layer, either one will do. If you go to a new layout, normally the array will update on start of layout so you have all the data each time so that solves your problem. The only difficult bit now is in learning arrays but they are powerful once you have control of them. There are a few nice tutorials about to help you with creating slots and understanding arrays : https://www.scirra.com/tutorials/583/ea ... g-an-array

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I like to do them in a separate layer rather then layout, that way you can have the inventory screen hovering over the game screen. To me it just looks better that way. Example: https://gamefaqs.akamaized.net/screens/ ... 7_2_22.jpg

    But if you're going to have the inventory cover the entire game screen anyways, then you may as well do it on a separate layout.

  • I use sprites for my inventory boxes and place holders and just move them on to the game layout when called for and off when not in use.

    You can use another layer for that same purpose which is probably easier but I rarely do things the easy way just they way I know works lol!

    Added: I just spent two days creating an inventory for my Platform Game Builder that has over 200 components. I set the inventory at the bottom of the layout and use scale when I want to expose it.

  • Now this is a huge inventory to manage and most items have multiple animations and behaviors.

  • I like to do them in a separate layer rather then layout, that way you can have the inventory screen hovering over the game screen. To me it just looks better that way. Example: https://gamefaqs.akamaized.net/screens/ ... 7_2_22.jpg

    But if you're going to have the inventory cover the entire game screen anyways, then you may as well do it on a separate layout.

    Doing it in different layout will reset the current layout when u return to it, it doesnt work :/ The entire layout where u were before opening inventory will be reset and start over haha xD

  • GPProd not if you know how to set it up properly. I've done it both ways. Like I said I prefer doing it with layers, but mainly because I like the look better.

  • GPProd not if you know how to set it up properly. I've done it both ways. Like I said I prefer doing it with layers, but mainly because I like the look better.

    What do u mean by 'set it up' properly? ^_^

    When i go back and forth to a layout, the character starts at the entrance again, all enemies have full hp, all enemies have respawned lol xD

  • If you want enemies to stay destroyed then you can use the Persist behaviour. If you want the character to spawn somewhere else you need to store the co-ordinates somewhere and use them when returning to the layout. This isn't really related to an inventory system though.

  • I'd say it's far easier to have the inventory menu in a layer instead of a separate layout, only because you don't have to worry about saving the current game state to load it back when you close the inventory.

  • GPProd look into the persist behavior as well as setting global properties. Then think about how you would set up a GUI to work across multiple layouts and go from there.

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