how do I control drag and drop like this example

0 favourites
  • 7 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Hi all

    Im wondering if someone might be able to tell me if this is posible in Construct 2 .

    Think in terms of a tower defence type map.

    As per picture the players avatar starts off life as in the pictures "normal state", when the player goes to move

    their avatar a ring is shown around the avatar when the mouse is over it.

    (this is not dificult, you just use animation and mouse over effect I assume.)

    The ring indicates the available area the player can move their avatar.

    Now the bit Im trying to work out

    The player then left clicks on the avatar and can drag and drop the avatar anywhere within the circle and place it where they want.

    In the game they can repeat this so the avatar can move around the map but only in steps within the area of the circle...if that makes sence.

    Any ideas on what events I should be researching to get this outcome?

    Sorry about bodgy pic, Im at work and had to use mspaint



  • I do have a question for you, will the circle always be there if you mouse over the avatar? If so, I would just make a mouse over event that makes the circle visible. Of course the circle is pinned to the avatar.

    Did that answer your question, kind of a little lost on what else you wanted to work out.

  • Yes the circle will allways be there if you mouse over it.

    Constraining the drag and drop to inside the circle and not having the circle move during the drag and drop is the bit doing my head in atm

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh sorry, I get it now.

    Well, easy to fix, on the mouseover event you see the circle which could always be there invisible, on the mouse down event you would have that circle disappear and another just like it appear at those coordinates and restrain movement of that player to those coordinates. That's the first way that comes to my mind, sure there are others. Need something more?

  • Im home from work, here is a capx file. (made in latest beta)

    What I want to do is:

    1: keep drag and drop inside the circle that appears.

    2: when you go to drag and drop again, the circle is re-centered on the "canons" new location

    and you can only drag and drop within the new circles location.

    if that makes sense...

    I'll continue working on a solution now Im home from work.

    Im thinking I need to create a family of both images and see if I can join them both with different behaviors...

  • my first attempt

  • my first attempt

    Thank you very much, your example does what I need I believe.

    Now to study .... thanks for your solution and example.

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