How do I Drag, Hold & Drop

  • Hi all, I have spent hours trying to allow the user to drag a block in game onto the map. I have got it working so that the user can click on the block, drag it and drop it when releasing the mouse button. However, I would like so that when the user is holding the block that the user will be able to hold down the mouse button, and the block will duplicate and place itself. My aim is to allow the user to drag out a wall. Having to click & drag for each block of wall will likely turn future players against me.

    I have got the grid working so that it snaps to a grid size of 38 (block size is 38) and that the user can only interact with the drag and drop ability providing that the global variable of wood is =>1 otherwise it's disabled.

    Thank you all

    UPDATE

    I'll post this again in hopes of it not being deleted.

    I have managed to find a solution to the issue I had above. This is for all of those that end up in the same situation looking for answers. Of course your way of doing what I wanted to do and achieve will be different but I am hoping that you will find some help in the solution below.

    imgur.com/a/eJ75I0lA

  • I did this mechanic with a theme park game to build paths, you can just have while mouse button is down, when cursor is over a particular grid square then change it to the texture of the block, or spawn it there depending how your game works. It also depends on how you set up the grid detection and how the original drag and drop works to drop in a block, you basically just duplicate that action as the mouse cursor moves over the centre of other squares in the grid.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks plinkie, I'll try this out.

    Update: See 1st Post Above for Solution

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)