Scripting Cookbook: What You Need
Implementing Touch and Release Notifications
Game Object Listeners
Putting It All Together
You walk into a dark room and flip a switch. A second later, a door opens across the way and light comes pouring in. But you don't get a chance to walk through the door—a couple of seconds later, the door slams shut and the room grows dark again. The trick? The door is only open for a few seconds, so you've got to flip the switch and run to get through the door.
How would you implement something like this in a game? That's what you'll solve in this chapter.
Every level in a typical game has a certain amount of unique code for environment interaction, ...