Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Drag and Drop  (Read 1388 times)
0 Members and 1 Guest are viewing this topic.
Offline straydoginc

Junior Member





« Posted 2005-12-08 21:33:47 »

Has anyone done a drag and drop system say for inventory where you can click with your mouse, drag the object to the paper doll let go and it equips?
Offline Mr_Light

Senior Member




shiny.


« Reply #1 - Posted 2005-12-09 01:17:32 »

have a look at http://java.sun.com/docs/books/tutorial/dnd/ esp http://java.sun.com/docs/books/tutorial/uiswing/misc/dnd.html#customComp

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2005-12-09 04:40:02 »

Has anyone done a drag and drop system say for inventory where you can click with your mouse, drag the object to the paper doll let go and it equips?

I wrote one quite a long time ago when DnD was brand new.  (Sorry I dont have the code any more.)  As already said, though, it should be *mostly*  straight foward. 

HOWEVER keep in mind that  typical; game "drag and drop" actually ISNT drag and drop in the DnD sense. Instead, all that really hapens is that the cursor image is changed to the moving object and a pointer set so the code knows what is currently "loaded" in the object. (In Java pointer translates to object refernce or int object id depending on your inventory system.)


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline straydoginc

Junior Member





« Reply #3 - Posted 2005-12-12 15:59:05 »

LOL which means that not only will i need graphics for each of my items, but a graphic that has the mouse pointer over the item too to make it look correct. Smiley

How much of a pain is this to implement? The struggle im having is that im wanting to do either a list (Final Fantasy) or a DnD type system for my inventory screen (where you can move items around and equip shizzicknits). For the first run of my game i want to use the KISS (Keep it simple stupid) method and get it done right. But don't want to spend a year on one part of the game which can be delt with in later releases.

So one versus the other... Which is easier to implement and also the easiest for the user to use given the most flexibility?
Offline Mr_Light

Senior Member




shiny.


« Reply #4 - Posted 2005-12-12 20:10:35 »

what I would do is notimplent kiss to my consept but reather to my implentation.

eg instead of showing an icon of the item simply use what the current drag n drop does; show a loaded or unloaded cursor. you even don't have to use images all togetter and go with text 'sword +3' alike.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline straydoginc

Junior Member





« Reply #5 - Posted 2005-12-14 15:15:26 »

Okay i figured out what i want to do using the Picture example and the List example.

Basically I would like the inventory to be a list and there to be a number of slots or boxes you can drag items into (like for head, shoulders, legs, chest, etc.) but the examples on that page or using pictures to make the boxes.

What is another J(something or other) that can be used to make like slots or rectangles that the item can be placed in? Almost like what a form field would look like.. just not a form field. Unless of course i answered myself Smiley

Thanx for the help
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!