Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Drag and drop objects for make a puzzle

  • #1, by TinTin 8 years ago Zitieren
    Hi

    I want make a puzzle scene with some piece of papers. But I don't know how can I make drag and drop objects. Is it possible? I couldn't find lua command in data structure.

    I appreciate for any suggestions
  • #2, by afrlme 8 years ago Zitieren
    Simplest solution would be to use the inventory system with dragging enabled so that you change the mouse cursor image to the item you are currently holding.

    I actually did some freelance a little while back for someone wanting the same kind of puzzle. I don't remember the details too well of what I did (just woke up a few minutes ago), but I know I didn't use the system I mentioned above. I believe I used a bit of Lua & some custom mouse cursors & an interface overlay to create an actual drag & drop system where you literally held the mouse & the paper piece you were holding dropped wherever you let go of the mouse. If you dropped the piece of paper anywhere inside of the correct slot then it would automatically slide to the correct position else it would remain in the position that you dropped it.

    I think I did actually intend on creating a tutorial for it at some point, but I probably got sidetracked & forgot all about it.
  • #3, by TinTin 8 years ago Zitieren
    Thanks. The inventory system is a nice idea. How can I put the pice of papers in random around the slots?
    Sorry my Lua programming is not good.
  • #4, by afrlme 8 years ago Zitieren
    Just use regular scene objects. You can hide them using conditions or values.

    You could also use characters too if you wanted or drag around animations or scene objects. There's lots of different ways you could go about sorting this puzzle out.

    Quick note: you don't actually need an item in your inventory to be able to assign it as an held item.
  • #5, by TinTin 8 years ago Zitieren
    Great!!. Got it. Thanks a lot. I'll write here if had another question.
  • #6, by TinTin 8 years ago Zitieren
    Sorry for old topic
    How can I make a drag and drop items  in  inventory slots?With suppose we have 32X32 slots
  • #7, by stothew 8 years ago Zitieren
    i don´t know if it is the best solution, but i would replace Mouse cursor if you click on it in the scene and do add Item on "leftclick" action on the slot. Then using the normal drag and drop for the other way around.
  • #8, by sebastian 8 years ago Zitieren
    what do you plan here? should the dragged item replace an item in the inventory and replace the old slot with the clicked item. So that they swap places? 
  • #9, by TinTin 8 years ago Zitieren
    In first post said that want make a puzzle. @ AFRLme said make inventory for it.
    My question is : How can I drag drop items on empty slots? Similar to inventory in "The Dig" game
  • #10, by sebastian 8 years ago Zitieren
    In first post said that want make a puzzle. @ AFRLme said make inventory for it.
    My question is : How can I drag drop items on empty slots? Similar to inventory in "The Dig" game
    Never played the dig, but i guess you need to fake the empty slot but having placeholder items with no graphic. Then you can swap items out via lua. When clicking on an item, it gets dragged. therefore you can iterate through all inventory items via a lua loop and when the item in your hand is the same as on the field, set this field to another item with "nothing" as graphic.
    When having an item in hour hand and clicking on an "empty" slot, swap them out again.
  • #11, by TinTin 8 years ago Zitieren
    How can write a drag item out of slots with lua? Sorry I'm not good programmer