Difference between revisions of "Script Classes for Adventure Games/Room Class"
(Created page with "Official SCI Documentation<br /> <div align="center"> Chapter: 1 | 2...") |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
Chapter: | Chapter: | ||
[[Script Classes for Adventure Games/Introduction|1]] | | [[Script Classes for Adventure Games/Introduction|1]] | | ||
− | [[Script Classes for Adventure Games/RootObj|2]] | | + | [[Script Classes for Adventure Games/RootObj Class|2]] | |
− | [[Script Classes for Adventure Games/Object|3]] | | + | [[Script Classes for Adventure Games/Object Class|3]] | |
− | [[Script Classes for Adventure Games/Collection|4]] | | + | [[Script Classes for Adventure Games/Collection Class|4]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Script Class|5]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Timer Class|6]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Feature Class|7]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/View Class|8]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/PicView Class|9]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Cycling Classes|10]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Motion Classes|11]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Avoider Class|12]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/Event Class|13]] | |
− | [[Script Classes for Adventure Games/ | + | [[Script Classes for Adventure Games/User Class|14]]<br /> |
− | + | [[Script Classes for Adventure Games/Game Class|15]] | | |
− | + | [[Script Classes for Adventure Games/Locale Class|16]] | | |
− | + | [[Script Classes for Adventure Games/Region Class|17]] | | |
− | + | [[Script Classes for Adventure Games/Room Class|18]] | | |
− | + | [[Script Classes for Adventure Games/Timer2 Class|19]] | | |
− | + | [[Script Classes for Adventure Games/InvItem Class|20]] | | |
− | + | [[Script Classes for Adventure Games/Block Class|21]] | | |
− | + | [[Script Classes for Adventure Games/Cage Class|22]] | | |
− | + | [[Script Classes for Adventure Games/Sound Class|23]] | | |
− | + | [[Script Classes for Adventure Games/StatusLine Class|24]] | | |
− | + | [[Script Classes for Adventure Games/File Class|25]] | | |
− | + | [[Script Classes for Adventure Games/Code Class|26]] | | |
− | + | [[Script Classes for Adventure Games/Global Variables|27]] | | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | [[Script Classes for Adventure Games/Game| | ||
− | [[Script Classes for Adventure Games/Locale| | ||
− | [[Script Classes for Adventure Games/Region| | ||
− | [[Script Classes for Adventure Games/Room| | ||
− | [[Script Classes for Adventure Games/Timer2| | ||
− | |||
− | [[Script Classes for Adventure Games/InvItem| | ||
− | [[Script Classes for Adventure Games/Block| | ||
− | [[Script Classes for Adventure Games/Cage| | ||
− | [[Script Classes for Adventure Games/Sound| | ||
− | [[Script Classes for Adventure Games/StatusLine| | ||
− | [[Script Classes for Adventure Games/File| | ||
− | [[Script Classes for Adventure Games/Code| | ||
− | [[Script Classes for Adventure Games/Global Variables| | ||
[[Script Classes for Adventure Games/Index|Index]] | [[Script Classes for Adventure Games/Index|Index]] | ||
</div><br /> | </div><br /> | ||
− | <div align="center"><span style="font-size: 22pt"></span><br /> | + | <div align="center"><span style="font-size: 22pt">The Room Class</span><br /> |
''Author: [[Jeff Stephenson]]''<br /> | ''Author: [[Jeff Stephenson]]''<br /> | ||
''Date: 5 April 1988''</div> | ''Date: 5 April 1988''</div> | ||
Line 62: | Line 39: | ||
| | ||
− | + | ==<br /> The Room Class == | |
+ | |||
+ | The Room class is the most specific Region. It is the point at which a picture, or 'scene' is defined for the player to walk around in. | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||game.sc | ||
+ | |- | ||
+ | |Inherits from:||Region | ||
+ | |- | ||
+ | |Inherited by:||none | ||
+ | |} | ||
+ | |||
+ | ===<br /> Properties === | ||
+ | |||
+ | <blockquote> | ||
+ | ==== picture ==== | ||
+ | <blockquote>The number of the picture corresponding to the room. Usually, this will just be the room number.</blockquote> | ||
+ | |||
+ | ==== style ==== | ||
+ | <blockquote>If style is specified, it overrides the global showStyle when picture is drawn during the Room's init:. Any other picture drawn once the Room is running must have its show style explicitly specified.</blockquote> | ||
+ | |||
+ | ==== horizon ==== | ||
+ | <blockquote>The y coordinate which is considered to be the room's horizon. Actors which have not had an ignoreHorizon: done on them cannot be positioned above this coordinate. Also, an Ego which hits this coordinate will have its edgeHit property set to northEdge.</blockquote> | ||
+ | |||
+ | ==== blocks ==== | ||
+ | <blockquote>A Set of software blocks (Blocks), rectangles which Actors are not allowed to enter.</blockquote> | ||
+ | |||
+ | ==== north <br /> east <br /> south <br /> west ==== | ||
+ | <blockquote>The number of the room to which you wish to automatically change when ego hits the specified edge of the room. If you wish to control the room change yourself when ego hits a certain edge, do not specify the room for that edge in the Room instance and check (ego edgeHit?) yourself. The edgeHit property will have the value northEdge, southEdge, eastEdge, or westEdge if ego hit one of the edges.</blockquote> | ||
+ | |||
+ | ==== controls ==== | ||
+ | <blockquote>A set of dialog items (DItems) which are push-buttons for this</blockquote> | ||
+ | |||
+ | ==== picAngle ==== | ||
+ | <blockquote>This property is the angle above level that you are viewing the picture. It is used to set the global perspective upon room entry.</blockquote> | ||
+ | |||
+ | ==== vanishingX <br /> vanishingY ==== | ||
+ | <blockquote>These are set according to where the vanishing point is in the picture to be shown. They determine the angle that the arrow keys will move ego in a room. The Up key will always move ego towards the vanishing point and the down arrow away. The default give a straight up and down in response to these keys.</blockquote> | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> Methods === | ||
+ | |||
+ | <blockquote> | ||
+ | ==== init: ==== | ||
+ | <blockquote>The default init: for a Room is to create an empty Set of Blocks, draw the picture specified by picture, and set ego's position based on its position in the previous room. You will want to supplement this with the following: | ||
+ | |||
+ | <blockquote>Load all views, sounds, pictures, etc. which will be required by the room so as to get all disk access done at Room initialization time.<br /> | ||
+ | Initialize all Actors and Actors which are to be in the Room initially.<br /> | ||
+ | Set a script for the Room.<br /> | ||
+ | Add any required Blocks to the Room.</blockquote></blockquote> | ||
+ | |||
+ | ==== doit: ==== | ||
+ | <blockquote>Send the doit: message to this Room's script, if it has one, then check to see if ego has hit the edge of the Room. If ego has hit an edge and there is a room number specified for the edge, invoke the newRoom: method to change to that room.</blockquote> | ||
+ | |||
+ | ==== dispose: ==== | ||
+ | <blockquote>This is called by the game when changing from this Room to a new Room. The game handles disposing of the current cast, then does a (curRoom dispose:). The default dispose: simply disposes of the Room's script, blocks, and controls. You will want to supplement this to dispose: of anything else which you have created which is specific to the Room, and any modules which the Room has loaded.</blockquote> | ||
+ | |||
+ | ==== setRegions: region [region ...] ==== | ||
+ | <blockquote>Sets the Regions which contain this room. This should be invoked in the init: method of the room. The parameters region are the script numbers of the regions. They should be listed from most specific to most general, since the order in which they are listed is the order in which they will be invoked. Thus, for a room in Ulence Flats in Space Quest, we might write | ||
+ | |||
+ | <blockquote>(self setRegions: ULENCE_FLATS KERONA)</blockquote> | ||
+ | |||
+ | to say that we are in the town of Ulence Flats on the planet Kerona. | ||
+ | |||
+ | The global variable regions contains the ID of a List of regions which are sent the doit: and handleEvent: messages in order when appropriate. The newRoom: method of Game puts the current room at the head of this list, and setRegions: adds Regions to the end of the list in the order in which they are listed in the parameter list. If the Region was used in the previous Room, it will be neither reloaded nor reinitialized. At the end of the newRoom: method, all Regions in the list which do not refer to the current Room are deleted.</blockquote> | ||
+ | |||
+ | ==== handleEvent: event ==== | ||
+ | <blockquote>The default Room method passes the event along to the Room script (if there is one) and then to any controls in the room.</blockquote> | ||
+ | |||
+ | ==== newRoom: n ==== | ||
+ | <blockquote>This method is the one to use when changing Rooms. It is invoked when the Room automatically changes to a new Room when ego hits the edge. Reimplement this method if you need to do some processing (such as dispose:ing a Region) before changing rooms.</blockquote> | ||
+ | |||
+ | ==== overlay: picture ==== | ||
+ | <blockquote>This method overlay a picture over the current picture.</blockquote> | ||
+ | </blockquote> | ||
| | ||
Line 75: | Line 126: | ||
| | ||
− | <span style="float: left">[[Script Classes for Adventure Games/|< Previous: ]]</span> | + | <span style="float: left">[[Script Classes for Adventure Games/Locale Class|< Previous: The Locale Class]]</span> |
− | <span style="float: right">[[Script Classes for Adventure Games/|Next: | + | <span style="float: right">[[Script Classes for Adventure Games/Timer2 Class|Next: The Timer Class >]]</span> |
| |
Latest revision as of 01:38, 11 December 2015
Chapter:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
Index
The Room Class
The Room class is the most specific Region. It is the point at which a picture, or 'scene' is defined for the player to walk around in.
In file: | game.sc |
Inherits from: | Region |
Inherited by: | none |
Properties
picture
The number of the picture corresponding to the room. Usually, this will just be the room number.
style
If style is specified, it overrides the global showStyle when picture is drawn during the Room's init:. Any other picture drawn once the Room is running must have its show style explicitly specified.
horizon
The y coordinate which is considered to be the room's horizon. Actors which have not had an ignoreHorizon: done on them cannot be positioned above this coordinate. Also, an Ego which hits this coordinate will have its edgeHit property set to northEdge.
blocks
A Set of software blocks (Blocks), rectangles which Actors are not allowed to enter.
north
east
south
westThe number of the room to which you wish to automatically change when ego hits the specified edge of the room. If you wish to control the room change yourself when ego hits a certain edge, do not specify the room for that edge in the Room instance and check (ego edgeHit?) yourself. The edgeHit property will have the value northEdge, southEdge, eastEdge, or westEdge if ego hit one of the edges.
controls
A set of dialog items (DItems) which are push-buttons for this
picAngle
This property is the angle above level that you are viewing the picture. It is used to set the global perspective upon room entry.
vanishingX
vanishingYThese are set according to where the vanishing point is in the picture to be shown. They determine the angle that the arrow keys will move ego in a room. The Up key will always move ego towards the vanishing point and the down arrow away. The default give a straight up and down in response to these keys.
Methods
init:
The default init: for a Room is to create an empty Set of Blocks, draw the picture specified by picture, and set ego's position based on its position in the previous room. You will want to supplement this with the following:
Load all views, sounds, pictures, etc. which will be required by the room so as to get all disk access done at Room initialization time.
Initialize all Actors and Actors which are to be in the Room initially.
Set a script for the Room.
Add any required Blocks to the Room.
doit:
Send the doit: message to this Room's script, if it has one, then check to see if ego has hit the edge of the Room. If ego has hit an edge and there is a room number specified for the edge, invoke the newRoom: method to change to that room.
dispose:
This is called by the game when changing from this Room to a new Room. The game handles disposing of the current cast, then does a (curRoom dispose:). The default dispose: simply disposes of the Room's script, blocks, and controls. You will want to supplement this to dispose: of anything else which you have created which is specific to the Room, and any modules which the Room has loaded.
setRegions: region [region ...]
Sets the Regions which contain this room. This should be invoked in the init: method of the room. The parameters region are the script numbers of the regions. They should be listed from most specific to most general, since the order in which they are listed is the order in which they will be invoked. Thus, for a room in Ulence Flats in Space Quest, we might write
(self setRegions: ULENCE_FLATS KERONA)
to say that we are in the town of Ulence Flats on the planet Kerona.
The global variable regions contains the ID of a List of regions which are sent the doit: and handleEvent: messages in order when appropriate. The newRoom: method of Game puts the current room at the head of this list, and setRegions: adds Regions to the end of the list in the order in which they are listed in the parameter list. If the Region was used in the previous Room, it will be neither reloaded nor reinitialized. At the end of the newRoom: method, all Regions in the list which do not refer to the current Room are deleted.
handleEvent: event
The default Room method passes the event along to the Room script (if there is one) and then to any controls in the room.
newRoom: n
This method is the one to use when changing Rooms. It is invoked when the Room automatically changes to a new Room when ego hits the edge. Reimplement this method if you need to do some processing (such as dispose:ing a Region) before changing rooms.
overlay: picture
This method overlay a picture over the current picture.
- Notes
< Previous: The Locale Class Next: The Timer Class >