<Solved>How to hide rooms that a player isn't in with room-based camera movement extension?

There is a huge problem with the room-based camera movement extension. That problem is that your rooms may not all be the same size. And you may not want to see the margins of the neighboring scenes in your game, though it could probably be alright in some rare cases. The old room-based camera movement example, about two years ago, I remember, had a knight character and good wall graphics, and there was some stipulation about needing a space between each of the rooms for the movement to work right, and that example explained how to fix this problem, but that example no longer seems to exist.

Problem: How do I make it so that anything not in the current room is hidden, either due to be covered up, blacked out somehow, or invisible.

I attempted to make it so that for each instance of rooms, if the player isn’t in collision of rooms, for each instance of everythinginrooms, if everythinginrooms is in collision with rooms (there might be a problem with how I did this, and it might be totally fine if I fixed it) then hide everythinginrooms.

However, this hid everythinginrooms invariably, so that everything in the current room was hidden, too.

Related screenshots:


For clarification, room-based camera movement has nothing to do with visuals other than the camera position and zoom.

For what you’re wanting to accomplish, you need to change your event structure entirely and add a few things.

  1. Use a regular event, not a “For each”.
  2. Add the first condition of “Rooms is visible”
  3. The second condition should be your collision check, inverted.
  4. Add a trigger once condition.
  5. Then your hide action. This will hide the room.
  6. You also don’t need the “For each instance of everything in room”. It can just be a normal subevent of the above.

You should almost never use the “For Each” unless you want different things to happen to the picked items than one another. At worst case if you want to be sure you’re applying it to everything applicable, you can use the Pick all condition, plusy your additional narrowing conditions. In most cases this will always be better performance wise.

Super quick mockup:
Scene editor:


Testing one box:

Same preview, different box:

Also if you’re thinking about my Top down adventure camera example, it’s still on the main site:

And in the in-engine example list (last option):

For some reason it still hides anything in the current room. I don’t know why, because it appears to work perfectly for you. Maybe it has something to do with how my walls are inside multiple rooms at a time.

BTW why you want to hide them?
Cause yesterday i had user on discord with similar question
His idea was that it will help performance
Where in reality it won’t

So if that was your goal you would need to delete rooms instead of hiding them

Yep. I split a wall into segments. Now one side works right.


So important detail: If an object is collision with any room the player is not in collision with, the object will be hidden, even an object also in collision with the room the player IS in collision with. Otherwise, thankyou for the help. But also, umm, it wasn’t your example there I’m talking about. Your example is cool for what it shows, how to do a top-down turn-based rpg, and that is something I will likely refer to for battle in my game, but there was, a few years ago, a room-based camera-movement example that is no longer there, that had a pixel character who was a knight, who could travel between two different rooms, and I’m actually not sure if it used trhe extension because there seemed to be borders, I think, that separated the rooms, rather than boxes. Don’t quote me on that, however.

BTW why you want to hide them?
Cause yesterday i had user on discord with similar question
His idea was that it will help performance
Where in reality it won’t

So if that was your goal you would need to delete rooms instead of hiding them

No, I didn’t consider it would help with performance. But I think it would help appearance a tad bit if the other rooms were hidden. Though the whole scene is technically active at one time, if there is indeed any action going on (there probably isn’t because most quests and things will occur on an as-you-come-to-it basis, rather than real-time) everything but what is in the current room is unknown, such as the fact that there is a secret room with a big ol’ magic chest on the other side of that wall, or else, a regular room that you are supposed to come to in your current quest, which has an extremely big and nasty surprise of combat . . . with a really mean boss.

Here is my current result, and one that presents an interesting dilemma: You definitely need a counter-event to signal when the objects and the rooms are supposed to reappear. On second thought, maybe just the objects in them, if you want your rooms to remain unseen surveyor’s marks, like with me, who really just wants the objects, npcs, and secret passageways hidden. This is why:
Okay, then, it would seem you cannot upload video. Heres why (in pictures like a comic strip):

When I reenter the room, everything has been hidden, because that was at one point, a room that has been hidden.

Here are my events, now (I edited them since the last post). Now, the problem seems to be that the room the player starts in is the room that is shown, no matter what room you are in. That sucks. Maybe if I got rid of trigger once? … (getting rid of trigger once) … opposite problem. Rooms are shown as the player comes to them. Aww, well, for my purposes, showing the rooms when the player comes to them and keeping them shown may just be the best course of action, because the player has already found any secrets in the room, and if they haven’t, they probably aren’t going to. But I have a much better way to do so, and it involves the special extension event of the player just entered a new room, being the room that is signified by this object. How was that worded? “Check if the trigger object has entered a new room on this frame.”

I mean
Hidden stuff works and are exactly the same performance wise as visible stuff

Like you have apple in hand and making it not visible won’t make it lose its weight or reduce/remove its physical size or space it eat up

Same with objects

Anyway you could check if something is inside camera borders
But you would need to put all these objects into same group
For example AllCrap

Now you go with compare two numbers
And you type in 1st number CameraBorderLeft()
In 2nd you type AllCrap.X()
And as sign you choose LESS THAN
And go same for other borders
CameraBorderTop() < AllCrap.Y()
CameraBorderRight() > GREATER THAN AllCrap.X()
CameraBorderBottom() > GREATER THAN AllCrap.Y()

And in action you pick Show AllCrap

For hiding it you go with opposite
AND you use OR statement
Add condition and type in search bar OR and add it
So condition will look like
If one of these conditions is true
CameraBordrLeft > AllCrap.X()
CameraBorderTop() > AllCrap.Y()
CameraBorderRight() < LESS THAN AllCrap.X()
CameraBorderBottom() < LESS THAN AllCrap.Y()

Action hide AllCrap

I think you would wish to throw some tween there with some masking object so it look smooth and not like elements are building itself
But check it out and decide then

I think at least activate these events when room is already in place

My chests, barrels, and other containers have randomly generated loot in the first six rows of the loot box (shown incomplete and unhidden in all my images), while the last six rows are empty unless in collision with a unique invisible box object, assigned specifically to that very container, which will fill the last three boxes with scripted loot. For performance, time, and simplicity in navigated the items menu, I reuse a lot of sprites. In fact, unless a sprite is very specific to itself, like a really big, extremely recognizable npc or a room (which, for the purpose of my game being side-story-driven (I do not plan on having a main storyline, just a bunch of really big side-quests) is numbered, then I will reuse it at some point; in most cases, frequently. I don+'t think this would work for me because my stuff isn’t room specific.

SOLVED: Woohoo! I’ve figured it out with Boolean / Propositional logic. The player is in collision with a room = P; The variable is true = T; Everythinginroom is in collsion with Room = C; Everythinginroom is visible = V.

P > T ; T > (C > V) ; ~ F > (C > ~ V)

For those unfamiliar with formal logic as a study, the Capitol letters represent something called propositions. A proposition is basically a single condition or action, as seen in GDevelop.

The propositions here are: If P (player is in room) then T (Variable is true), If true, then if everythinginroom is in collision with rooms, then it is visible. If player is in room (inverted), then false. If false, then if in collision, hidden. Its actually quite simple. Who knew formal logic class was this useful? (It actually didn’t really occur to me until I started making this post.)

Here is the finished result. This is how you hide all the rooms besides the one you are currently in.

For mine, the rooms are on a layer that is hidden by default, and thus don’t need to be made visible, but it might conserve performance if you just used regular, visible ground tiles. Your floors should be on the base layer, probably with a z-order of 0, because I already made the mistake of putting them on a separate layer, and ythey just didn’t show up,l even though the layer was visible. Your rooms should be modular, and be fully separate from each other, without so much as a wall crossing over from one room to another or else that wall will likely be permanently hidden if you use one of the previously stated methods because there is no check for whether or not an object is in the current room or not, and it just looks cleaner not to have walls that are only partially inside your nice, clean rectangle. I don’t know what would happen if an object were between two rooms on this method, but it couldn’t be pretty, I am sure, because of the two different events that would be in conflict. It might be suggestible to have a dark colored background, but really just for cosmetic improvement.