Inventory, layer or layout?

Get help using Construct 2

Post » Sat Jan 28, 2017 6:22 pm

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? ^_^
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sat Jan 28, 2017 7:32 pm

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.
B
46
S
16
G
74
Posts: 2,096
Reputation: 44,201

Post » Sat Jan 28, 2017 10:07 pm

plinkie wrote: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?
B
12
S
3
Posts: 164
Reputation: 1,530

Post » Sat Jan 28, 2017 10:52 pm

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
B
46
S
16
G
74
Posts: 2,096
Reputation: 44,201

Post » Sat Jan 28, 2017 11:05 pm

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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Sat Jan 28, 2017 11:13 pm

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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Sun Jan 29, 2017 12:11 am

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

Image
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Mon Jan 30, 2017 1:14 pm

Burvey wrote: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
B
5
S
1
Posts: 37
Reputation: 451

Post » Mon Jan 30, 2017 3:06 pm

@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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Mon Jan 30, 2017 4:02 pm

Burvey wrote:@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
B
5
S
1
Posts: 37
Reputation: 451

Next

Return to How do I....?

Who is online

Users browsing this forum: Anonnymitet, atmas, tarek2 and 26 guests