Drag

Get help using Construct 2

Post » Thu Nov 17, 2011 12:14 am

Good evening.

I'm trying to make a game where you can drag an item onto a character. A dress up game if you will. What exactly can I do to make this happen? I tried mouse clicking and that worked some what until I clicked again and it moved the item another few pixels away.

Any help would be good.

Thanks in advanced

-theCosmicWitch
B
3
G
2
Posts: 3
Reputation: 1,131

Post » Thu Nov 17, 2011 12:51 am

Have a look at my Capx here, it uses drag and drop for level making, it may help you.

http://www.scirra.com/forum/level-creation-capx_topic46125_post288864.html#288864tonycrew2011-11-17 00:52:18
B
40
S
14
G
11
Posts: 243
Reputation: 9,432

Post » Thu Nov 17, 2011 3:52 am

I made this for you:
http://dl.dropbox.com/u/23138239/drag%20object.capx
Clothes will go to a pre defined position when mouse button is released in a -15 to +15 pixels distance on X and Y to that position.


Now if you want to release it over a moving object than you should make the clothes have a pin behavior and pin them to it in the third and fourth events.

After that you should set an every tick event activated only when the clothes are in the righ position (you can make that using the system in the third and fourth events or using instance or local variables.
This event should set the clothes to the character's position on the image points specified for them or you could use some math to set X and Y coordinates by the character's coordinates.

Hope this isn't confusing a lot, i'm kinda drunk :P
Tuiii2011-11-17 03:57:13
B
19
S
3
G
3
Posts: 56
Reputation: 2,496

Post » Fri Nov 18, 2011 8:43 pm

lol thanks for the help guys I appreciate it! I'll start working it out now and post if I continue to have issues.

Cheers

edit: Works like a charm, thanks again ^^theCosmicWitch2011-11-19 02:12:39
B
3
G
2
Posts: 3
Reputation: 1,131

Post » Wed Nov 23, 2011 3:47 pm

okay I've added new stuff to it, but one of the items runs away from my mouse when I click on it. I'm not sure why it's doing that because I'm pretty sure I have everything in there correctly.

edit: also I want to know if it's possible to upload an image right into the game so the user can use that image. Like a picture of themselves that they can drag in place of the character's head. theCosmicWitch2011-11-23 16:25:58
B
3
G
2
Posts: 3
Reputation: 1,131


Return to How do I....?

Who is online

Users browsing this forum: jeffige and 0 guests