If you have played the Xbox One game Pneuma: Breath of Life you will be familiar with the unique “eye locks” that open doors and move bridges etc. The idea is that you have to be looking at the eye in order to open a door, look away and it shuts (so sometimes you end up walking backwards or sideways through doors so that you are always facing the eye). The whole world is built using booleans. (In this tutorial we are using power on and power off, but you could use true and false booleans instead).
This is fairly simple to do in Spark using the see sensor.
Door that opens if you can see the eye.
- First go to Brain/Properties/Sensors and make the Vision Sensor visible in your hero. You will notice it has a very wide beam. You will want to reduce that to a narrower beam. Grab the handle on the sensor and bring it down and in to create a smaller cone. You are going to be using the 1st person camera so you need to have the see sensor no wider than the view you get with this camera. The length of the view is up to you. Do not make it too long. Give the hero a first person camera instead of a follow camera to get the same feel as Pneuma, though it will work with a 3rd person follow camera.
- Create your eye signpost. Attach your eye to your signpost (do not glue, as it will make the whole of the signpost the sensor, we only want the eye as a sensor).
- Place a door. The sci fi doors are good for this. If you make your own door kode, make it so that it opens and closes using the power on and off status. The speed of the door opening and closing will depend on the puzzle you are making, so make sure you think about this when making your door mechanism – does it shut immediately you look away, or does it close slowly so you have a chance of getting through it before it closes?
- In the eye brain type this
WHEN [IWP:your hero][see][line of sight][me] DO [IWP:door][power on]
…WHEN [else] DO [IWP:door][power off]
Door that closes if you can see the eye.
Same as before except
WHEN [IWP:your hero][see][line of sight][me] DO [IWP:door][power off]
…WHEN [else] DO [IWP:door][power on]
Bridges that move when you can see the eye.
- Place a bridge which is turned so that you cannot use it.
- Attach an eye to it on the side, slightly under the bridge, with similar to code above (IWP:bridge)
- In the bridge brain
WHEN [has power] DO [yaw][object relative][slowly]
The bridge will move clockwise as long as the eye is in sight.