Complex Doors

Get help using Construct 2

Post » Mon Nov 11, 2013 4:11 pm

I have many doors in my game, each door is opened and closed by a 'power cell', when the player hits the cell, (for the sake of animation) every 0.2 seconds I add one to a 'power cell charge' variable, when the charge reaches 7 I set a 'charged' bool to true.

At this point, the door opens along with some lights surrounding it.

To open the door I give every effected sprite a 'cellNumber' variable and I say:

When PowerCell is 'charge'
When PowerCell "PowerCellNumber" is 1
When Door "PowerCellNumber" is 1
When lights "PowerCellNumber" is 1

Open door & turn on lights.

I've got tens of doors in my levels, there's got to be a more simple way of doing this but I've wrestled with it for hours. This current system doesn't even work particularly well.

Can anyone help me out?

Thanks
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Mon Nov 11, 2013 5:33 pm

sounds like you are looking for the function object. Just code once and repeat with different parameters.
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 » Mon Nov 11, 2013 5:59 pm

I tried this but it doesn't work because i have multiple instances of everything - It means if I open one door they all open lol
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Mon Nov 11, 2013 6:05 pm

It should work if you call the function at the right spot and/or pass the right parameters to the function.
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 » Mon Nov 11, 2013 6:08 pm

Try 'Pick By Comparison'. then pick all doors with PowerCellNumber the same as PowerCell.PowerCellNumber
B
47
S
14
G
7
Posts: 603
Reputation: 8,151

Post » Mon Nov 11, 2013 6:49 pm

I think using families, "pick by UID" and some arrays could be better.
B
15
S
1
G
1
Posts: 15
Reputation: 1,051

Post » Mon Nov 11, 2013 7:03 pm

@EncryptedCow

Wow pick by comparison almost works - but it doesn't work when I have it as 'trigger once' - which is something I need to do for the animation, sound and collisions etc
B
44
S
13
G
8
Posts: 622
Reputation: 7,417


Return to How do I....?

Who is online

Users browsing this forum: ardhitosen, kurtbal and 10 guests