I think this is perfectly do-able.
You can move an actor or set of actors with “Set Actor Location”. Simply get their current location, break the vector, then add the hallway segment’s width to the “X” value, apply the result to the actors.
As far as adding a new hallway segment, this can be made easier by always adding it in the same place. Run a “Spawn actor from class” at a set location.
I’m gonna load up MSPaint and draw some stuff…
Ok so this is completely dependent on how you have the rest of your level set up, but it can be changed to accommodate whatever you have.
I think it would be best if both trigger box A and B performed the exact same function, for simplicity.
So in frame 1, the initial setup with all the rooms labeled. At this point, I would also create an array containing each hallway. At the moment, it will only have one hallway (Room 5).
In frame 2, actors 3, 4, and every hallway piece will need to be shifted to the right. (Note: I didn’t notice the doorway on the right room until after I made this, so it may be that you need to shift everything to the LEFT so it doesn’t overlap other map contents.)
This can be done be getting room 3, getting it’s location, breaking the vector, adding the hallway’s width to X (or Y, depending on your rotation), and setting it back as room 3’s location.
Then do the same for 4.
Then, using the array containing each hallway, run a “For each” loop on it and do the same thing done for rooms 3 and 4.
Now, all the appropriate rooms should be shifted to make room for a new hallway segment.
In frame 3, a new hallway segment is added (Spawn Actor from Class) at the location just outside of Room 2 (green blob). For simplicity, you can always use the same location and keep shifting everything right. That hallway should then be added to the array containing the hallways.
There are some downsides to this.
- Without a condition check, the hallway could extend infinitely and push the set of rooms infinitely in one direction. You will need to leave one side completely open to leave room for everything to shift.
- If the hallway segments are not identical, the player may notice exactly which hallways moved and which one was spawned, destroying the illusion.
- If the player can somehow be in the hallway when all this happens, it will again destroy the illusion.