I've got a crazy idea that only uses events.
Surround the character with 4 events, each one with the "same as characters" priority.
Set the one on top (or the sides) to Parallel process. Its events will be:
Spoiler: Event in parallel process
If the player character is facing up:
| Store the player's X position
| Store the player's Y position in a different variable
| Subtract 1 from the Y variable
| Teleport (no fade) to the X and Y variables, facing down
| Move the 4 events back around the player (update the player's position variables, then nudge them by 1 one by one to get the adjacent positions)
end
If the player character is facing left:
| Store the player's X position
| Subtract 1 from the X variable
| Store the player's Y position in a different variable
| Teleport (no fade) to the X and Y variables, facing down
| Move the 4 events back around the player (update the player's position variables, then nudge them by 1 one by one to get the adjacent positions)
end
If the player character is facing right:
| Store the player's X position
| Add 1 to the X variable
| Store the player's Y position in a different variable
| Teleport (no fade) to the X and Y variables, facing down
| Move the 4 events back around the player (update the player's position variables, then nudge them by 1 one by one to get the adjacent positions)
end
What about moving down? Since the player character is supposed to always be facing down, we have to operate differently.
In the event at the bottom of the player, set its trigger to "Player touch". Then in its events:
Spoiler: Events in player touch
Store the player's X position
Store the player's Y position in a different variable
Add 1 to the Y variable
Teleport (no fade) to the X and Y variables, facing down
Move the 4 events back around the player (update the player's position variables, then nudge them by 1 one by one to get the adjacent positions)
Now all that's left to do is to handle obstacles.
Give me a little time, and I'll come up with a project that does it.
Update: I took a different approach that works a lot better and handles obstacles very easily.
Download (Google Drive)