GUI Inventory Discussion
by Rich Hudson · in Torque X 2D · 10/31/2007 (9:58 pm) · 3 replies
Hi guys,
I am well into a 2-D RPG and its time to for the dreaded drag and drop inventory (say dragging some loot from a popped up gui representing the contents of a chest, to inventory slots).
The Inventory management side of this is not an issue. What I am trying to figure out is what is the best plan for doing what I want? I am using gui objects (they hit "i" and an inventory screen pops up), and want to be able to detect that the user is dragging a thumbnail from one gui element to another...
Anyone else tackled this? i can't believe I would be the first....
What approached worked, didn't work?
-J
I am well into a 2-D RPG and its time to for the dreaded drag and drop inventory (say dragging some loot from a popped up gui representing the contents of a chest, to inventory slots).
The Inventory management side of this is not an issue. What I am trying to figure out is what is the best plan for doing what I want? I am using gui objects (they hit "i" and an inventory screen pops up), and want to be able to detect that the user is dragging a thumbnail from one gui element to another...
Anyone else tackled this? i can't believe I would be the first....
What approached worked, didn't work?
-J
#2
Since your talking about drag&drop, i'm assuming your game is for Windows, not Xbox 360, right?
John K.
11/01/2007 (1:41 pm)
I think James has a great approach with using scene objects. You can easily set a state variable andmount items to your cursor to perform the drag, then change state and unmount for the drop. I'm working on a Gui control for my inventory manager, but that's because there is no drag&drop, just highlight and button select. However, my understanding is that multiple scenegraphs can be created in Torque X. Since your talking about drag&drop, i'm assuming your game is for Windows, not Xbox 360, right?
John K.
#3
I don't NEED drag and drop, click-equip will work fine.
Appreciate the feedback, anyone else have 2 cents?
-J
11/01/2007 (7:03 pm)
Some good ideas.I don't NEED drag and drop, click-equip will work fine.
Appreciate the feedback, anyone else have 2 cents?
-J
Associate James Ford
Sickhead Games
I think there are two options... make it using gui controls or make it using sceneobjects.
If your inventory scene has tons of little objects that can be dragged around individually this sounds a lot more like a scene with sceneobjects than a gui. Having tons of little gui controls floating around just sounds like a nightmare to me but then again I'm sure its possible.
The problem with using sceneobjects is in torquex "I believe" that there is only one scenegraph at a time, which means you cant just open up your inventory on top of the level scene, you would have to just do inventory management between levels or something like that. "Correct me if I'm wrong here".
I started implementing a drag and drop inventory in TGB which is a bit different than TorqueX, because I was able to make a separate scenewindow for my inventory gui, and load the special inventory level file. This file contained a tilelayer for my inventory (just the grided background) and another for the other invetory (chest). Then each inventory item was a staticsprite which could be dragged around with the mouse and then when dropped would "clamp" to the position of the tile you dropped it on.
I have a feeling that if you want something like this in TorqueX you will need to create some custom gui controls to do exactly what you want.