0 Favourites

How do I dynamically create a sprite and drag-drop

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,330
RetroDaddy's avatar
RetroDaddy
Unread hot topic
86 28,714
St4rDu57's avatar
St4rDu57
Unread hot topic
99 10,139
karshinkoff's avatar
karshinkoff