How do I drag and drop multiple objects to various locations

Get help using Construct 2

Post » Sat May 24, 2014 6:23 pm

Hey,
I found a file someone uploaded and tried to add more content which would snap to 15 different locations.
I copied the events (of red) and changed the names accordingly but the new objects all snap to the same block and ignore the other ones.
I want to learn how to implement this feature and hope that someone would be able to point me in the right direction.

The final goal is to have 12 different colored blocks that can be snapped to any of the 15 locations.

Thanks for any hints and advise which helps me to do this. - V
You do not have the required permissions to view the files attached to this post.
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Sat May 24, 2014 8:14 pm

Take a look at the attached file. I modified your capx as follows:

1 - I added a family called "Colors" and put all the dragable sprites into it.
2 - I gave the pin and drag and drop behaviors to the family.
3 - I modified all the events for red to instead use the family.
4 - I removed the pin and drag and drop behaviors from the individual rectangles so you don't have to duplicate your events for each.
You do not have the required permissions to view the files attached to this post.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Sat May 24, 2014 8:29 pm

FragFather,
first of all, THANK YOU for helping me!

I will need to upgrade before I can open it because I am using release 168 and you seem to use 170.

The other day, I used a pre-release and had trouble saving because there was an issue with minify.

Anyway, I will upgrade for sure because I am curious to learn what you have made.

Again, thank you for working on this,

V :)
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Sat May 24, 2014 10:11 pm

@ FragFather

Wow, this is awesome!

Thank you for showing me how to make this kind of app.

What would be the best way to attach one unique sound to each of the colored blocks?
Last edited by vancouver on Sun May 25, 2014 4:09 am, edited 1 time in total.
B
14
S
4
Posts: 190
Reputation: 1,735

Post » Sun May 25, 2014 3:25 am

Add an instance variable on each color containing the file name of the sound and add an audio action to play a sound by name using the variable.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Sun May 25, 2014 3:57 am

@FragFather,
I have not used instance variables yet .... but I will try and see if I can figure it out.

I am really impressed by what you have done. - V

P.S. Could you show me how to to this for one color?
What would I use for Name, Type and Initial Value?

P.S.S. I am also wondering how I could implement a feature which gives me a new instance on start drag (to create an endless supply of note blocks).
B
14
S
4
Posts: 190
Reputation: 1,735


Return to How do I....?

Who is online

Users browsing this forum: banquetburger and 14 guests