-=-=-=-=-=-=-=-=-=-=-

Designing a gaming system

-=-=-=-=-=-=-=-=-=-=-


How will they interact?

A player object would contain a list (or inventory) of item objects. The player object would also contain the current location (which is a reference to a room object). The player would be given a description (perhaps from an overloaded toString() method for the room object), and shown a list of items (if any) at that location.

Next, the player would get, or use, items at the location which might trigger events (perhaps revealing a blocked door entrance). If a character object is present, it might speak, attack the player, or leave through an exit. The player might also choose to use an exit object (stored in each room object) to move from one room to another.

Don't worry if all this seems a little unclear to you at the moment (though hopefully, by providing you with examples of interaction, the object model will be easier to understand). When we start building the objects, and putting it together, everything will make more sense.

<-- Back to "Creating a text-adventure game"

Prev