Click on the spheres to move through sections!
The floating bridge, in front of the Wizard's Tower. The spheres that reveal the bridge are controlled by the Clarity Spell script.
The Clarity Spell
Objects that are affected by the Clarity Spell have a special script attached to them. When the script detects a hit by the Clarity Spell, it calls a function that intiates the transformation process.
The script detects that the Clarity Spell has hit the object. Then it calls a function based on the type of transformation that the object requires.
Once the script detects a hit, each object behaves differently depending on their transformation. In the case of the villagers, who transform into animals, their animal transformation activates and teleports to the villagers' position. At the same time, the villager deactivates, creating the illusion that the villager is actually transforming.
The villager disappears as soon as the Clarity Spell hits her, and the horse appears in her place.
This part of the script makes the animal appear, and teleports it to the correct location
Other objects, like the masks, don't react to the Clarity Spell until both torches in front of them have been lit by the player. In order to count how many torches are lit, the script has a counter that increases after the players lights a torch. Once the counter reaches the target, the mask gets the purple glow and the player can use the Clarity Spell on it.
The masks have a delayed effect, and they don't get the purple glow until two torches are lit. A counter controls the number of lit torches in the script.
The Gravity Mechanic
Players get the impression that they are travelling between the floor and the ceiling when using the Gravity Portals. In reality, they are travelling between two identical maps, with the second one being a replica of the first one, but rotated 180 degrees.
The original castle map
The rotated castle map
Each portal has a reference to its "twin" portal in the inverted map. Once the player activates the portal, the script teleports the player to the opposite portal.
Each portal has a reference to its twin portal in the opposite map.