Game Development Community

GUI Script positioning vs Manual positioning

by Drethon · in Game Design and Creative Issues · 07/30/2009 (7:39 am) · 1 replies

I'm working on a gui (TGB though probably applicable to 3d too) that includes cargo hold representations where you can pick up an item from one and drag and drop it to the other (assuming certain criteria are met).

For the moment I'm implementing it by creating a large rectangle object that is the "hold" with small squares within it that represent positions within the hold and these small squares are where the item dragged into the hold latches to.

My initial thoughts were to mount the position objects to the hold object and when an item is dragged into the hold area have the hold search its mounted positions for an open position.

The alternative I was thinking of was to do away with the position objects and have the hold keep track of how many objects it contains and when an item is added it will use a simple position algorithm to determine where to latch the item within the hold.

The first approach requires less math and allows the positions to be created visually so its easy to see if things are arranged properly just within the constructor. The second approach requires more math and is harder to visualize without running the program but seems more expandable.

Is there anything I've overlooked that would make one particularly more desirable over the other? Thanks

#1
08/04/2009 (2:44 am)
I implemented the DragAndDropGui in T3D by looking at the editor Palette .ed.cs and .gui. It is like a bucket that holds the data in it until you drop it on the page.