How do I move objects instance with one button

Get help using Construct 2

Post » Tue Sep 29, 2015 4:45 am

i have object with six instances of it
i want to move all six instances with one button and get back to their position with another button
how can i do this
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Tue Sep 29, 2015 8:49 am

If you don't specify a specific instance in the event the actions will be executed by all instances..
If you only want to move specific instances you should make it clear which ones, for example by giving them an instance variable or putting them on a specific layer or any other way to differentiate them from other instances and add the condition needed.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 29, 2015 9:04 am

but i have no idea how to specify one instance
m not getting this point
Image
B
68
S
40
G
48
Posts: 680
Reputation: 34,066

Post » Tue Sep 29, 2015 1:15 pm

luckyrawatlucky wrote:but i have no idea how to specify one instance
m not getting this point


If you want all instances to react at the same time you don't have to specify one instance..

If you want one instance to react, you should tell the computer which one..
If you know which one you mean, you should be able to tell the computer..
For example, select an instance by touching it, pick the nearest to something, etcetera..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 29, 2015 1:24 pm

I'm new to Construct 2 so this could be wrong:
- when you create the buttons, make them find the UID for all 6 instances of the object you want to move and store them (in a uid array)
- when the first button is clicked, loop through the array and use the "pick using UID" action to pick each one, store it's location (in a global location array), then move it
- when the other button is clicked, do the same loop but this time put the picked object back where the global location array says it used to be

How you find the UID of the particular objects is what LIttleStain has covered already.
B
5
Posts: 17
Reputation: 259


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 20 guests