How do I Use the same object to control 2 other objects

Just started using Construct 2? Post your questions here

Post » Sat Dec 31, 2016 3:45 am

Message: michaellankshear can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Using the same object to control 2 other objects. this one is hard to explain for a beginner. My game is a platformer. The aim of the game is to collect coins that are hidden in chests. To open the chest you have to answer a math question. I have successfully got the question working thanks to bbenny93. My issue now is that when i goto the first chest and answer the question both of the chests will open and give you a coin. I probably doing it all wrong. Do i have to create seperate question popups for each chest or can i use the same one but when answered they only open up 1 chest? Ive attatched the CAPX file so you can have a look. Thank you in advance.

http://www.filedropper.com/zeeba_1
B
4
S
1
Posts: 6
Reputation: 312

Post » Sat Dec 31, 2016 4:20 pm

Basic exercise in using Instances and picking Instances.
Notice that there is only 1 chest sprite, 1 coin sprite and 1 check sprite. Hence, there is only 1 event / game action, yet it works for all.

https://www.dropbox.com/s/ibwbdgqmx2jn5 ... .capx?dl=0

This principle is the whole big idea behind the Construct 2 engine, and if you ask me, the beauty of it.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 31, 2016 4:31 pm

Give your chests their own instance variables instead of using global. Then amend the events for the chests to use their instance variables.
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Thu Jan 05, 2017 12:34 am

sorry for the late reply. Thanks a lot guys. So much to learn but this opens up so many possibilities. Thanks again!
B
4
S
1
Posts: 6
Reputation: 312


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests