How do I dynamically create a sprite and drag-drop

Get help using Construct 2

Post » Tue Nov 25, 2014 7:55 pm

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.
B
5
Posts: 13
Reputation: 253

Post » Wed Nov 26, 2014 4:28 am

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
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Nov 26, 2014 5:23 pm

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.
B
5
Posts: 13
Reputation: 253

Post » Wed Nov 26, 2014 8:33 pm

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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Nov 28, 2014 3:47 pm

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?
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 13
Reputation: 253

Post » Mon Dec 01, 2014 9:59 pm

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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: mcscooter, TRMG and 34 guests