Hi,
I’m trying to write a simple 2d game where the user can drag and drop different objects on the screen.
Each of these objects is made from a Prefab i’ve created with a Drag and Drop component (which handles events like mouse_drag, mouse_down etc’).
There is an inventory on the side of the screen with scaled images from where the user can drag the different objects to the game screen (after that he can continue to drag these objects. Thats why Iv’e written the drag & drop functionality in the object’s class and not in the inventory’s class).
I’m having a little bit of trouble understanding how I should implement it:
The first thing i’ve tried was to show only icons for the different objects in the inventory and then, when they were clicked and dragged, attach the actual game object to the mouse. But that didn’t go so well because i couldn’t really understand how to set the game object in the correct place and then use its drag and drop component to drag it around.
The second thing i was planning to do was to put the actual prefabs (my game objects) in the inventory (maybe scaled down a bit) and then they can give their own drag and drop functionality…
I would really appreciate some guidelines or opinions about the design because I feel i’m doing things kinda wrong…
What do you think?
Thank you,
Moria.