Inventory object discussion

New releases and general discussions.

Post » Sat Feb 28, 2009 12:41 am

Some of us have been discussing this on the chat; how exactly do you think an inventory object should work?

My idea is that you'd place and drag an inventory in the layout editor, and have properties such as rows, items per row, background texture, etc.

Then you'd have actions like:

[list:3kyhiqux]
[*:3kyhiqux]Add item
- Name
- Sprite object[/*:m:3kyhiqux]
[*:3kyhiqux]Remove item[/*:m:3kyhiqux]
[*:3kyhiqux]Set item attribute[/*:m:3kyhiqux]
[*:3kyhiqux]Save[/*:m:3kyhiqux]
[*:3kyhiqux]Load[/*:m:3kyhiqux][/list:u:3kyhiqux]

And some configurable drawing options.

Essentially the object would set up and draw your inventory, with your item sprites, and handle drag/dropping and clicking notifications.

Any thoughts on this before I begin..?
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sat Feb 28, 2009 12:46 am

My idea is to offload as much as possible onto other objects. For example, use an object to define a grid. Imagine that your object would only handle grids with square cells, and someone needs a hex-based grid. With grid defined in another object adapting it would be as simple as replacing the grid object with another one, rather than throwing the whole inventory object away and implementing stuff from scratch.
My main idea is that small changes in design should require small changes in code. A (relatively) small change from square grid to a hex grid shouldn't render your object unfit for the task.
B
4
G
4
Posts: 65
Reputation: 1,305

Post » Sat Feb 28, 2009 1:08 am

So basically, an inventory object, as well as a behavior.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Feb 28, 2009 1:47 am

It sounds brilliant, but to use it I would need to have it work with custom systems.

In the game I'm working on, I have it like an adventure game, where you open the inventory, click on an item to have it disappear from the inventory and follow the mouse, then I can close the inventory and then click on a sprite to use the item on it. Currently I have a sprite that follows the mouse around and has all of the item animations, and automatically sets itself to what the mouse is carrying.

If it was possible to get values and had enough control options, then it sounds fantastic! :D
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Sat Feb 28, 2009 8:28 am

I agree with Shviller, that is why I posted a feature request for Grid Object. 8) I had inventory in mind as well as customizable tile maps or even compound sprites (containing different minor sprites such as body, clothing that you can change/recolor and eyes that you can change color of).

As for inventory, it has to have the following features:

- limited or unlimited (numbered slots to unlimited slots)
- stacking (multiple items of the same type in the same slot) - option (different for say armor, which shouldn't be stackable, and ammunition, which should stack).
- Put into inventory (at specific slot, at first free slot if there is no stackable of the type already)
- Get from inventory (by slot or type) - substract/destroy or do not destroy (do not destroy is very useful for toolbars)
- sorting (based on type, stacked amount, OID, expression etc.)
- move between slots (swap, stack or split stackables...)
- not necessary - varying item sizes (big armor would take more slots, etc., however that is merely a display thing; the space would be defined by size of grid and 3x4 object would occupy that much in 10x10 inventory space).

Leave the way of putting/getting to other behaviors (drag/drop, mouse click etc.) via events.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Feb 28, 2009 8:38 am

[quote:wymuetwd]- stacking (multiple items of the same type in the same slot) [/quote:wymuetwd]

Not sure if that's a good idea, you could have a thousand sprites all in one spot.
Perhaps an automatic counter that would place text where you want it when you have multiple identical items?
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Sat Feb 28, 2009 8:47 am

Er, yeah, that is what I meant, it'd have one sprite, however it would store the amount of instances stored in the inventory slot. Sorry I was not clearer :)

So, for stacking items, only one instance would be needed, destroy and spawn instances as needed... ammunition, potions etc.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Feb 28, 2009 11:24 am

Yeah, stacking as in multiple instances per slot is rather important.

Okay, I think I'm gonna begin..
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Tue Mar 03, 2009 6:01 pm



OK, thoughts on this so far?

Should I add a grid feature?
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Tue Mar 03, 2009 7:11 pm

I would like simple explanation in the upper tab in for the event wizard , for everything selectable.

Won't it be simple to integrate ? All text could be taken from the wiki definitions or so.
B
2
G
3
Posts: 29
Reputation: 908

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests