You can do an endless number of things with game scripting like this. Here are just a few ideas for some additional environment interaction:
- Pull three levers (perhaps in a certain order) to open a door.
- Pull a lever to partially fill the room with water, which allows you to walk on the (now floating) platforms up to higher locations.
- Cut the suspending rope of a bridge to cause the bridge to fall, where you can find a secret room below.
- Set fire to a wall to burn it down so you can get to the other side.
- Push a block onto a button to keep a door open.
- Touch a button to turn on a hologram that gives you information about the map.
Also, the code in this chapter can be extended and enhanced in many ways. Here are some ideas for extending functionality:
- Make lots of commonly used scripted objects, such as doors and switches, so they don't have to be written repeatedly.
- Show a different polygon group, depending on an object's state. For example, a red button could glow green when touched.
- Perform actions when the user presses an "action key," such as the right-mouse click or the Enter key.
- The player can stand on platforms that move up and down, but also let the player stand on platforms that move side to side.
- Allow creation of scripted heads-up displays.
- Script all objects of the same type instead of just unique objects (for example, add scripted methods to all Projectile objects).
- Add other types of notifications (destroyed, moving, stopped moving, and so on).
- Perform certain actions when the player has specific items or when the player tries to give an item to another character.
- Create UI notifications, such as activating in-game help screens when the player touches a never-before-seen object.
- Add a hot key that reloads scripts on the fly so that the level designer can easily tweak scripts in-game.
- Allow scripts to be compressed and stored in a file in such a way that would make it difficult or impossible for players to edit the scripts (no cheating!).