How do I dynamically create a sprite and drag-drop

0 favourites
  • 6 posts
From the Asset Store
Use inertion of your movements to throw, rotate your objects and etc. Objects can interact with others while dragging.g
  • I am new to construct 2 and I am trying to set it so a player clicks a sprite image (as if a button). The sprite is cloned and sticks to the mouse so the new cloned sprite can be dragged and dropped any place on the screen with the second mouse click.

    I can clone the sprite but need the new object to stick to the mouse until placed on the screen with the second left click.

    Any examples or suggestions would be appreciated!

    Thanks in advanced.

  • You're saying 'drag and drop' but that only requires 1 mouse click, not two. Can you clarify what you actually need?

    edit: anyway try this. A 1-click option

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. This works and I like the approach. I set up one using variables.

    I am trying to create a math scratchpad that the user clicks a button (first click) and the created math symbol attaches to the mouse and is released with the second click. After that the created symbol can be dragged and dropped "normally" by holding down the mouse key if it is later needed to move.

    I thought of this approach because some times the student would click the button several times so it would create too many symbols around the button.

  • Glad you have a solution. I prefer instance variables as they don't pollute the code and can be used more easily for picking. By all means share your solution.

  • Here is what I got so far and I plan to create all the symbols in 1 sprite with initial color and clicked color for each symbol. I am not sure which approach works best for this project.....or would it be better to use a combination of both?

  • Hard to say, try and see. I'm not sure why you're doing your own drag and drop code but it that's fine, might be more flexible for you.

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