Set up the following array of Logic Bricks on the new camera:

Also add a Boolean (Bool) property called
binoculars and set it to False.
I'll go through this setup a piece at a time to help you understand it. The Property
binoculars is a Boolean property which the game engine will use to track whether you're looking through the binoculars or not. Be sure the property is set to Bool or it will not work correctly. The first logic set is fairly simple: when the "B" key is pressed -> (AND) -> Assign the property "binoculars" the value !binoculars. This looks odd at first, but it's really just the way to tell the game engine to set a Bool property to its opposite. (True becomes False and vice versa).
Further on the logic bricks tell the game engine what to do depending on the state of the Bool property. If it's True, the game engine switches the view to our new camera (this is why you needed to save its name) and adds the OverlayScene called Binoculars. (We will make this scene in the next step)
If the property is False, the GE does the opposite, switching back to your usual camera and removing the Binoculars scene.
Note that Blender does not allow you to reference scenes which do not exist yet in the logic bricks. You'll have to add actuators relating to the Binoculars scene after you create it in the next step.
The last step... making an overlay so that your binoculars have that cheesy double circle they always use in the movies!
Add a new empty scene and name it Binoculars. (At this point you can finish the actuators from before) In the empty scene, add a camera with a plane in front of it, as seen at right. >
In GIMP or Photoshop make an Alpha-masked texture for the double-circle. (You can alternatively just use the one from my demo file.) Set the face to Alpha drawmode while in Face Select mode, and you're ready for action! Go back to your original scene, and you should now be able to use the binoculars by pressing B.
DOWNLOAD THE FINISHED DEMO FILE
|
 |
Challenge For an additional challenge, try creating a function which allows the player to zoom in and out. Hint: the solution involves a Lens IPO and the IPO/Property actuator. Good luck!