• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows leaving collision

G

Gizimo

Guest
I'm creating rooms that are black before you enter them. When the player enters the room become visible but it remains that way permanently, I would like the rooms to become dark again after the player leaves.
 

NightFrost

Member
Well you... do the opposite when making them visible? I mean, since you are able to make room content visible, somewhere in your code something does know what things to change. I assume it flips visibility states on instances. Judging by the topic name, you have a collision object which, upon hitting the player, runs through this procedure to reveal room content. So you could do something like this: make the collider cover the entire room. Give it a variable that tracks covered room's visibility (a true/false boolean, starts in false). Then step event code runs the following logic:
Code:
if visibility variable is false:
   if player is in collision with this instance:
      make room contents visible
      set visibility variable to true
else if visibility variable is true:
   if player is not in collision with this instance:
      make room contents invisible
      set visibility variable to false
You can freely stretch content in room editor, so it should be easy to cover each room just so.
 
Top