This may be a somewhat complicated/confusing issue, so I will try to be direct and clear. Please bear with me.
I am working on a Pacman remix game. To make things more interesting, there are sections of the maze where the wall shift, creating alternate junctions at the opposite end of the wall that shifted. These sections of walls switch positions (moving back and forth) randomly and independently of each other. SO the chaos is real, my friends!
I won't go into detail on how I make it work (you can review the .capx if you like), but I used sprites - the JunctionCheck objects - to identify which directions Pacman can travel at any given junction. (Yes, I tried to use the Solid behavior on the walls, themselves, but that proved problematic. Hence, this "convoluted" system.) With the WallSlide objects, the available directions open to Pacman or the Ghosts constantly changes every time the walls shift. For the most part, this system works...though I'd like to refine it a little.
The problem I have discovered, which seems to have come after some other changes I made, is that there are times when the JunctionCheck objects do not always get their respective Boolean values updated/toggled every time the WallSlide object shifts. (I use an instance variable to identify which sliding wall the JunctionCheck objects are related to.)
For instance, there is a corridor that runs north/south, and on the left side of the corridor, there is a section of the wall that shifts. It's in its "up" orientation. This means that the top part of the sliding wall is flush with the normal section of the wall. At the bottom end of the sliding wall, there is a junction where Pacman can move eastward.
If you open up the .CAPX I provided above, here's how the process works (starting at event line 94).
1. All WallSlide objects have their instance variable WallSlideTimer ticking down to zero.
2. If the timer is <1, a warning will occur signaling that the wall is about to slide positions. (This works fine.)
3a. If the timer is <0, reset the timer (to ensure this event only happens once while true) and set the instance Boolean variable IsSliding to true (this is to call on only the WallSlide instances that are ready to slide).
3b. The instance variable LerpLowHigh is my check to tell the system when to shift the wall up/down or left/right (in relationship to another instance variable).
4. While the Boolean variable IsSliding is true, the system will check to see when it has reached the end of its lerp transition. When it has, it will set IsSliding to false to ensure this process only happens once.
5. When the lerp has finished its transition, it will call on all the JuctionCheck objects that are associated with it. Each JunctionCheck has two sets of variables: one that says what directions are available at any given time and another that says which of those directions are to be turned on or off when the walls have finished sliding. So if the direction North was open to travel at a junction, but then the wall slides, the N_open Boolean will be toggled to false (where it was previously true). It will only toggle the Boolean values if its respective (direction)_changable Boolean variable says it can be toggled (it must have a true value itself).
6. Then, at lines 115 and 116, the position of the walls are updated accordingly.
The only thing I cannot figure out is why the Boolean variables (ie: N_open) will sometimes not update properly even when the other JunctionCheck objects associated with the same wall will update just fine.
I suspect the problem started when I added the IsSliding Boolean variable, but even if that's the case, I do not see how that could cause the problem. Alternatively, because there are so many JunctionCheck instance objects to deal with, it is somehow possible that some are not getting properly picked? (I have manually checked in the debug that all the instance objects are toggling, but occasionally they get "missed" and then end up with the opposite value than what they should have.)
Someone with a keener eye than mine would be greatly appreciated.
It's likely my understanding of how picking works or some other factor is escaping my grasp here...
Thank you again for your patience and your help.
PS: NO, I am not going to put this game up to sell. It will be free-to-play as I very clearly do not own the rights to Pacman. I'm doing this for my portfolio and to grow my game dev skills. ... Just because someone is GOING to ask and others already have.