Hey everybody,
Yet again there is something bothering me. This time it’s doors. I included a sample capx so everybody can check what I try to describe here :)
How everything will work:
Each door has boolean variable isLocket. This needs to be false for player to be able to open a door. Door_Opener sprite object is added as a container. This will serve as a trigger. When player overlaps with this object and Door is not locket (boolean variable isLocket = false), correct door will open. There is also a condition that a proper animation of the door is playing before door can be opened. Then, when player isn’t overlapping Door_Opener, correct door will close.
Here is couple of screenshots to give you a perspective.
Picture1:
h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/working%20both%20opened.png
Picture2:
h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/working%20one%20opened.png
Problem is that the other door's won’t close if player is overlapping with multiple Door_Opener’s.
Picture3:
h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Door%20screenshots/not%20working%20both%20opened.png
I did found out how to correct this. Just needed to add “for each: Door” -condition and then everything will work properly. Sample capx contains 2 door groups. Enable/disable to switch between working and not working events.
My question is though: why I need to add that “for each” condition? I though that boolean variable (isLocket) will pick each object separately (and also Door_Opener's because they are containers of Door ohject's).
Or clearly there is something I don’t know about containers and how they behave :)
Sample capx: h*t*t*p*s://dl.dropboxusercontent.com/u/43020976/Doors%20and%20container/Open_door_with_container_r233.capx
-M-