I have an idea for a map generator, and I am unsure about the actual eventing on it, theoretically I believe I have a way of doing it, but I could use a nudge in the right direction.

Here's the rundown of my way of thinking: I have an active with 1 animation with a bunch of frames, each frame is a type of room. I make a bunch of copies of this active and place it as a grid.

Then I create another active, let's call this "the decider" It moves from room to room and center itself to the center of the room. Then it decides in which direction it will go, when it has decided on a direction, let's say down the room it currently occupies is decided and the frame is changed accordingly, repeat this process for a few times.

Inherently I see an issue: What if the room it occupies is by the frame edge and it's not possible to go up, how do I stop it from deciding to go up?

The idea is to make a map like a dungeon from Zelda for the nes with just a bunch of rooms next to each other, basically.