Open/Close Doors (Multiple Objects)

Get help using Construct 2

Post » Sun Sep 15, 2013 1:22 pm

Hello, I have some problems with the doors. How can I control multiple doors individually? Thank you for your help.

Here is the *.capx file:
https://www.dropbox.com/s/lw4wpwajvpgxge3/Door_Actions.capx
B
7
S
2
Posts: 84
Reputation: 754

Post » Sun Sep 15, 2013 4:08 pm

I imagine the same way you'd do anything that involved multiple instances... Use the condition and select a specific door by it's UID...
B
14
S
6
G
1
Posts: 143
Reputation: 1,795

Post » Sun Sep 15, 2013 5:00 pm

That's was my first idea, but how I can control UID's?
B
7
S
2
Posts: 84
Reputation: 754

Post » Sun Sep 15, 2013 6:10 pm

I just give them an instance variable (I call it "which") and then assign them a number myself (1, 2, etc.). Then I just say

If door.which =1

Then do whatever you want.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sun Sep 15, 2013 6:25 pm

I like to use the IID instead of the UID, because it's fixed.

If you hardcode using the UID, you could accidentally change all the UIDs in your game and you'd have to change each line of code manually (at least that happened with C2 a while ago, not sure if this still happens).

Let's say you have 3 doors in a layout; if you pick them by IID, their respective numbers will be 0, 1 and 2, in the order they were created.

IF player entered door
AND door.IID = 0
-> Go to layout
B
123
S
43
G
41
Posts: 847
Reputation: 28,206

Post » Sun Sep 15, 2013 6:26 pm

[QUOTE=wossi] That's was my first idea, but how I can control UID's?[/QUOTE]

No need to make anything messy like that, here is one way to do it: door example

@C-7 Isn't that exactly duplicating what UID's are meant for? :)
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Sun Sep 15, 2013 6:48 pm

[QUOTE=vee41] [QUOTE=wossi] That's was my first idea, but how I can control UID's?[/QUOTE]

No need to make anything messy like that, here is one way to do it: door example[/URL]

@C-7 Isn't that exactly duplicating what UID's are meant for? :)[/QUOTE]

Oh thank you! I can not tell you how grateful I am to you! You make my day! Thank you very much! ;Dwossi2013-09-15 18:49:40
B
7
S
2
Posts: 84
Reputation: 754


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 59 guests