So far, I've got the control system for Pacman working fine.
I'm using JunctionCheck objects to determine which direction Pacman can go next. Each instance of JunctionCheck has a variable for each direction which states if that direction (north, south, east, west) is true/available or false/not available. (I probably could have set it up in an array, too....ah, but that that's 20/20.
But now I need to set up a system for the Ghosts which will be very much like the controls for Pacman, but which will be operated automatically instead of by the player/manually using the same JunctionCheck objects.
My dilemma is that there will be a mixture of 1-4 directions to choose from and, obviously, each combination will be different. It will be easy enough to manually enter which directions are available for the A.I. ghosts to choose from (that's already set), but the number of directions to choose from will be tedious to enter in without creating too any event lines.
What I'm after is something like this:
- Code: Select all
Ghost On Overlap w/ JunctionCheck | Set GhostDirection to choose(Direction 1, Direction 2, ...)
BUT, the code will only list those directions which are true/available. If a path doesn't have and optional east path, then that won't be part of the list of options to choose from.
Any suggestions on how I can do this concisely? Thanks for your help!