Check out the new @mentions and Tagging Feature!
We're testing a feature out on the forums, user @mentions (Twitter style). You can also tag users on a post/thread at the top of each page.Please have a play and PM Simon or post here if you experience any issues.

Destroy if you make a wrong turn in a maze...?

Hi guys!

I'm working on a maze game where you have to follow a "leader" through a complex series of turns and crossroads. I've got my Leader set up with Path Movement, moving on a path through the maze, and my Player has 8-direction movement - the Leader and Player seem to be working well.

Here's the part that's hurting my brain:
I want the Player to be Destroyed if they make a wrong turn, and I don't know how to do that.
The Leader path crosses over itself and re-travels the same path in some places, so I can't just use collision walls to trigger the Destroy because the paths can't be permanently blocked.

Basically, you have to follow the exact path that the Leader goes, in sequence.

So if you're on a grid, and the leader goes up 2 spaces, then right 6 spaces, then down 3 spaces, then left 3 spaces...
and the Player goes up 2 spaces, then right 6 spaces...but MISSES the down turn (either fails to make the turn at that intersection or turns the wrong way) - DEATH!!!! and Restart!

Does that make sense?

Anyone have any ideas for how to accomplish this?

The second tricky part:
I'd also like the Player to be able to turn off the path in certain places to grab Bonus tokens. The tokens would be on"offshoot" dead-end paths that the Leader never goes down, but that the Player can quickly zip into, grab the token, then get back to following the Leader. In that case, when the Player takes a turn that is not on the Leader's route, I DON'T want to Destroy the Player. So maybe I can designate those Bonus Offshoot areas as "safe" somehow?

I plan on making each level a new maze with a new path to follow and jump to the next frame when you reach the end, so it only has to run through the path sequence once per frame.

PS: I'm a noob, just starting to get the hang of fusion 2.5 - never really coded before, but I'm learning!

Any ideas, examples, etc. for how to do this stuff would be much appreciated!

Sounds like what an ant does to follow another ant. The lead ant will leave a scent trail of droplets that evaporate with time to mark a trail for other ants to follow. The next ant will smell the scent and try to follow unless the scent has evaporated and it gets lost or killed.

As the lead person moves over a space set a integer for the space that is then counting backwards to zero. The next player will follow if the space is not zero. If it is zero ... well then the following player will die.

For the tokens mark the token trails spaces at the start of game with a fixed integer (like 5) that "does not count backwards" with time to zero. Instead, wait until the "following" person takes the trail and the "token trail spaces" start the countdown for "the spaces of the trail leading to the token" to zero. That way, if in the future the "following" person tries to take the trail they will die since the trail spaces will be marked as zero.

Thank you, droberson! I'll try to wrap my head around that - unfortunately, I am a visual artist with a remedial grasp of math, so this is largely Greek to me!
However, after doing some more fiddling, I think perhaps it would play better (and be simpler) to allow players to take wrong turns, but die if they get too far behind. So maybe when the Leader reaches the end of the maze, it'll wait for several seconds and if you don't catch up and get to the end within that time frame, you'll have to restart.

Create an active object and duplicate it all over the place in the Maze where the Leader can move. Name it Trigger. It must be big enough that you can't miss it. Rename one of Trigger's flags to LeaderWasHere. When the leader overlaps Trigger, set Trigger's LeaderWasHere on.
Now create an event that destroy the player if it overlaps Trigger and LeaderWasHere is off.