Forum rules - please read before posting.

Recreate a "drag-and-drop" puzzle

Hi all,

Hope you are doing well! :)

I was just curious to know -- might it be possible to recreate something like this with Adventure Creator's inbuilt capabilities?

(Roughly from the 0:44 - 0:51 mark)

I suppose an idea I have is opening up a menu where I can use my mouse to drag things around, but I'm unsure how to layer different images on top of each other here, if that makes sense!

Another thing is that it's kind of a "matching" thing where the player should click on the item that is right, and if the item is right, it will be added to the inventory. Otherwise, if the player clicks on the wrong item, a dialogue-cutscene will be played.

However, since the clicking will be used for both dragging and selecting items, I am kind of confused on how to go about it.

Any help is appreciated, thank you!

Comments

  • This kind of gameplay can be achieved through scripting - but such scripting can be found within the "Puzzle template: Item arranging" package over on AC's Downloads page.

    The basic technique is to rely on Hotspots for any item that can be picked up, which then gets replaced with an equivalent inventory item when selected.

    Check out the included example's JigsawPuzzle scene. The items snap back to their original position when let go, but you can change this to be more like the video by unchecking Revert Postion When Let Go in each Piece's Arranging Puzzle Piece component.

    To have the puzzle "appear", don't use a Menu - instead, parent everything to a root GameObject and just move that object into view at the appropriate time.

    Another thing is that it's kind of a "matching" thing where the player should click on the item that is right, and if the item is right, it will be added to the inventory.

    Since puzzle pieces are Hotspots, you could add an Examine interaction to run an additional ActionList when right-clicked. However, I'll see if the template can be updated to separate clicks vs drags.

  • Thank you so much! Will check this out!

    Oh yes that would be great -- would love to know if there is a way I can separate clicks vs. drags -- thank you so much! :)

  • Done - a new "Action List On Click" field is now exposed, which will run if a piece is clicked but not dragged.

  • Thank you so much! Excited to try this out! :)

  • Was revisiting this to start working on puzzle -- was just curious to know about two things:

    1) Is it possible to modify the script on my end, such that there is no associated ID with the images I am dragging? I noticed that the associated ID links to inventory ID items (as you mentioned above!), but I just want the graphic that I am selecting in the scene view (like in the video) to follow the cursor, not an inventory item.

    So this is just equivalent to having the "selected piece position" follow the cursor (in the Arranging Puzzle Manager script) run instead of having the inventory item position update alongside it as well.

    2) Is it possible to change the "Action List on Click" field to run when an item is double-clicked, not single clicked?

    Thank you! :)

  • The package's technique involves leveraging the Inventory's drag-and-drop system, as well as Hotspot-Inventory interactions, so the use of Inventory items is necessary for it to work. While a piece is selected, the actual scene sprite is hidden off-screen while the Inventory item equivalent takes over.

    If you wanted to do without this, you'd need to rely on a separate technique - as items are too embedded within it to just be removed. Though, you could use the provided script as a starting point.

    If you're just looking to be able to drag Hotspots around (without dealing with associated interactions with other Hotspots) then you could remove the template in favour of a simple script that just moved the GameObject while the mouse is held down over it.

    To have the ActionList run when double-clicked, you can either have a custom script hook into the OnDoubleClickHotspot custom event, or assign it as a regular Hotspot "Use" interaction, and set the Hotspot's Double-clicking field to Is Required To Use.

  • Thank you so much! I think I got it to work! :)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.