Revolving Door Implementation
Posted: Sun Sep 16, 2012 3:11 am
In the game Tripkey I happen to have a department store, so I decided to have the Department Store have a revolving door at the entrance, and when they push on the door, it changes where they can exit the revolving door. I could have used OUT for leaving the revolving door in both case, but I wanted them to have to use IN when entering the store and OUT to exit.
This presumes the user starts inside the store. Reverse the condition and the name of the room if they are not.
Here's how, in general:
------------------------------
Arnold Horshack: Oooh, oooh, oooh, Mistah Kottah, I know what "parking_lot" is in that thing up there!
Mr. Kotter: What?
Horshack: A fuse box!
This presumes the user starts inside the store. Reverse the condition and the name of the room if they are not.
Here's how, in general:
Code: Select all
! Grammar
verb "push","press"
* DoVague
* pushable DoPush
! grammar handlers
Routine DoPush
{
if location is toward_store
{
location.name = "In the revolving door, facing the parking lot."
location is not toward_store
print "go OUT to leave building"
} else {
location.name = "In the revolving door, facing the entrance to the store."
location is toward_store
print "go IN to enter building"
}
MovePlayer(location)
}
! Attributes and properties
attribute Pushable ! Can be pushed or pressed
! Room and object definitions
! Room "vestibule_inside" is, obviously, the entry room
! to the store, and what "parking_lot" is, is an exercise
! for the reader
Room Revolving_Door "In the revolving door, facing the entrance to the store."
{
is toward_store
long_desc
"PUSH DOOR to rotate revolving door"
IN_to
{
if self is toward_store
MovePlayer(Vestibule_Inside)
else
print "You are facing the parking lot. Go OUT to leave, or PUSH DOOR to be able to enter the store."
}
OUT_to
{
if self is toward_store
print "You are facing the store entrance. Go IN to enter, or PUSH DOOR to be able to exit the store."
else
MovePlayer(Parking_Lot)
}
}
object entrance_door ! So they can "push door"
{
in Revolving_Door
is pushable, static, hidden
adjective "door"
}
Arnold Horshack: Oooh, oooh, oooh, Mistah Kottah, I know what "parking_lot" is in that thing up there!
Mr. Kotter: What?
Horshack: A fuse box!