Saturday, September 8, 2012

Someone’s Knockin’ at the Door, Somebody’s Ringin’ the Bell

Trust me, The Beatles in no way inspired, or assisted me in the design of this logic.  Today I present to you the logic controlling the doors in my maze level.  You might think that it shouldn’t be that complicated to open and close a door and normally you would be right.  However, these doors do a little more than that.

If you remember me mentioning that when you press the “X” button, while driving the hovercraft, it “generates” a power pulse that triggers the doors in the maze.  If you don’t remember that, please go to my previous entry and get caught up with everyone else.  For the rest of you, continue reading.

door logic

The power pulse from the hovercraft turns on a magnetic key, which is detected by a sensor in the door logic, if the player is close enough.  On the circuit board, the sensor is on the right edge of the circuit board, shown above.  While this sensor is activated, it triggers the three timers, just to it’s left.  The timers count up from 0 to 1, 2, and 3 seconds.  As each timer reaches it’s limit, it triggers a magnetic key, and a sound generator.  Each of the magnetic keys trigger, wirelessly, pieces of sticker panel attached to the top surface of the door.  The first one lights up the two outermost pieces, the second one lights up the next two pieces, and the third one lights up the middle piece.  These are only in place to give the player a visual clue that the door is charging and will open or close soon. 

The other action that takes place, when the last timer reaches the 3 second mark, is sending a signal to two AND gates.  These gates are located on the left side of the circuit board.  The other leads, coming into the AND gates come from a sensor that checks to see in the door is currently open, or closed.  This sensor is at the upper left-hand corner of the circuit board.  I turned on the setting that checks to see if the magnetic tag it is trying to sense is on the same layer as the sensor.  This means that I only need one tag/sensor pair to determine the status of the door.  Just below the sensor is a NOT gate.  When the sensor does not “see” the “door open” tag, the NOT gate triggers, which activates the AND gate that leads to the mover that closes the door.

Below the AND gates are two timers.  These timers are set for 0.5 seconds.  This creates enough delay that the last piece of sticker panel on the door lights up before the door opens/closes and everything resets.  The timer on the right, sends a signal to the mover that opens the door, and the OR gate to the right.  The timer on the left sends a signal to two OR gates.  The OR gate on the right, the one with three inputs, is used to reset the three timers, thereby shutting off the magnetic tags, thereby turning off the pieces of sticker panel on the door.  The final OR switch, the one that triggers the “door close” mover, also takes input from one last sensor. 

The last sensor on this circuit board looks for a signal that indicates that one of the matching doors, from another section of the maze, is closing.  Since each section of the maze will be the same, they all have doors in the same locations.  The magnetic key, in the lower left-hand corner, triggers when a door closes, and the other three matching doors will notice this turning on and close, if they are currently open.  Confusing, isn’t it?  The idea is that a player can take the time to close the door behind them, and close the matching doors for their opponents.  One of the special obstacles I have planned.

I know this was a bit long, but there was quite a bit of logic on this one.  If you have any questions, please post them in the comments.

No comments:

Post a Comment