Difference between revisions of "Script Classes for Adventure Games/Cycling Classes"
(Created page with "Official SCI Documentation<br /> <div align="center"> Chapter: 1 | 2...") |
|||
(8 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 Cycling Classes</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 Cycling Classes == | |
+ | |||
+ | The Cycle class is the basic class which implements cycling behavior in Actor and its sub-classes. Sub-classes of Cycle implement specific cycling behavior. | ||
+ | |||
+ | ===<br /> Cycle === | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||Code | ||
+ | |- | ||
+ | |Inherited by:||Forward | ||
+ | |- | ||
+ | | ||Reverse | ||
+ | |- | ||
+ | | ||CycleTo | ||
+ | |} | ||
+ | |||
+ | ====<br /> Properties ==== | ||
+ | |||
+ | <blockquote> | ||
+ | =====<br /> caller ===== | ||
+ | <blockquote>The object to be cue:ed when the Cycle completes.</blockquote> | ||
+ | |||
+ | =====<br /> client ===== | ||
+ | <blockquote>The Prop, Actor, etc. which is being cycled by an instance of Cycle.</blockquote> | ||
+ | |||
+ | =====<br /> cycleDir ===== | ||
+ | <blockquote>The direction in which the client's cels are to be cycled. | ||
+ | <blockquote>1 forward (cel numbers should increase)<br /> | ||
+ | -1 backward (cel numbers should decrease)</blockquote></blockquote> | ||
+ | |||
+ | =====<br /> cycleCnt ===== | ||
+ | <blockquote>The number of animation cycles since the current cel of the client was displayed. When this equals the cycleSpeed of the client, the nextCel: method is invoked.</blockquote> | ||
+ | </blockquote> | ||
+ | |||
+ | ====<br /> Methods ==== | ||
+ | |||
+ | <blockquote> | ||
+ | =====<br /> init: ===== | ||
+ | <blockquote>Do any necessary initialization of the Cycle class and ensure that the client is updating.</blockquote> | ||
+ | |||
+ | =====<br /> doit: ===== | ||
+ | <blockquote>Called by the client as doit: self, this method sets the cel of the client to the appropriate value based on the particular Cycle class.</blockquote> | ||
+ | |||
+ | =====<br /> nextCel: ===== | ||
+ | <blockquote>Used by the doit: method to move the cel number in the direction indicated by cycleDir.</blockquote> | ||
+ | |||
+ | =====<br /> cycleDone: ===== | ||
+ | <blockquote>This is invoked when the client's cel reaches a destination cel. If the Cycle class is one of the cyclic ones, this just wraps the cel to either the beginning or end of the current loop. If it is a terminating Cycle class, this cue:s the caller.</blockquote> | ||
+ | </blockquote> | ||
+ | |||
+ | ===<br /> Forward === | ||
+ | |||
+ | Cycles an Actor through its cels in the 'normal' order — from 0 through the end of the loop and back to 0. Set with (actor setCycle:Forward). | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||Cycle | ||
+ | |- | ||
+ | |Inherited by:||Walk | ||
+ | |} | ||
+ | |||
+ | ===<br /> Walk === | ||
+ | |||
+ | This is a Forward cycle type which only cycles an Actor when the Actor is moving. Set with (actor setCycle:Walk). | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||Forward | ||
+ | |- | ||
+ | |Inherited by:||none | ||
+ | |} | ||
+ | |||
+ | ===<br /> Reverse === | ||
+ | |||
+ | Cycles an Actor through its cels in the reverse order of that in Forward, i.e. from the highest cel number to 0 and then repeating. Set with (actor setCycle:Reverse). | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||Cycle | ||
+ | |- | ||
+ | |Inherited by:||none | ||
+ | |} | ||
+ | |||
+ | ===<br /> CycleTo === | ||
+ | |||
+ | This class allows you to cycle to an arbitrary cel and stop. It is set by (actor setCycle:CycleTo toCel direction [caller]). | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||Cycle | ||
+ | |- | ||
+ | |Inherited by:||EndLoop | ||
+ | |- | ||
+ | | ||BegLoop | ||
+ | |} | ||
+ | |||
+ | ====<br /> Properties ==== | ||
+ | |||
+ | <blockquote> | ||
+ | =====<br /> endCel ===== | ||
+ | <blockquote>The number of the cel at which the cycling is to complete.</blockquote> | ||
+ | </blockquote> | ||
+ | |||
+ | ====<br /> EndLoop ==== | ||
+ | |||
+ | This sub-class of CycleTo advances the cel of an Actor from the current cel to the cel which is the end of the current loop for the Actor, then stops and cue:s its caller (if it has one). Set with (actor setCycle:EndLoop [caller]). | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||CycleTo | ||
+ | |- | ||
+ | |Inherited by:||none | ||
+ | |} | ||
+ | |||
+ | ====<br /> BegLoop ==== | ||
+ | |||
+ | This sub-class of CycleTo decrements the cel number from its current value to 0, then stops and cue:s its caller, if any. Set with (actor setCycle:BegLoop [caller]). | ||
+ | |||
+ | {| | ||
+ | |width= "125"|In file:||motion.sc | ||
+ | |- | ||
+ | |Inherits from:||CycleTo | ||
+ | |- | ||
+ | |Inherited by:||none | ||
+ | |} | ||
| | ||
Line 75: | Line 183: | ||
| | ||
− | <span style="float: left">[[Script Classes for Adventure Games/|< Previous: ]]</span> | + | <span style="float: left">[[Script Classes for Adventure Games/PicView Class|< Previous: The PicView Class]]</span> |
− | <span style="float: right">[[Script Classes for Adventure Games/|Next: | + | <span style="float: right">[[Script Classes for Adventure Games/Motion Classes|Next: The Motion Classes >]]</span> |
| |
Latest revision as of 01:56, 22 January 2016
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 Cycling Classes
The Cycle class is the basic class which implements cycling behavior in Actor and its sub-classes. Sub-classes of Cycle implement specific cycling behavior.
Cycle
In file: | motion.sc |
Inherits from: | Code |
Inherited by: | Forward |
Reverse | |
CycleTo |
Properties
callerThe object to be cue:ed when the Cycle completes.
clientThe Prop, Actor, etc. which is being cycled by an instance of Cycle.
cycleDirThe direction in which the client's cels are to be cycled.
1 forward (cel numbers should increase)
-1 backward (cel numbers should decrease)
cycleCntThe number of animation cycles since the current cel of the client was displayed. When this equals the cycleSpeed of the client, the nextCel: method is invoked.
Methods
init:Do any necessary initialization of the Cycle class and ensure that the client is updating.
doit:Called by the client as doit: self, this method sets the cel of the client to the appropriate value based on the particular Cycle class.
nextCel:Used by the doit: method to move the cel number in the direction indicated by cycleDir.
cycleDone:This is invoked when the client's cel reaches a destination cel. If the Cycle class is one of the cyclic ones, this just wraps the cel to either the beginning or end of the current loop. If it is a terminating Cycle class, this cue:s the caller.
Forward
Cycles an Actor through its cels in the 'normal' order — from 0 through the end of the loop and back to 0. Set with (actor setCycle:Forward).
In file: | motion.sc |
Inherits from: | Cycle |
Inherited by: | Walk |
Walk
This is a Forward cycle type which only cycles an Actor when the Actor is moving. Set with (actor setCycle:Walk).
In file: | motion.sc |
Inherits from: | Forward |
Inherited by: | none |
Reverse
Cycles an Actor through its cels in the reverse order of that in Forward, i.e. from the highest cel number to 0 and then repeating. Set with (actor setCycle:Reverse).
In file: | motion.sc |
Inherits from: | Cycle |
Inherited by: | none |
CycleTo
This class allows you to cycle to an arbitrary cel and stop. It is set by (actor setCycle:CycleTo toCel direction [caller]).
In file: | motion.sc |
Inherits from: | Cycle |
Inherited by: | EndLoop |
BegLoop |
Properties
endCelThe number of the cel at which the cycling is to complete.
EndLoop
This sub-class of CycleTo advances the cel of an Actor from the current cel to the cel which is the end of the current loop for the Actor, then stops and cue:s its caller (if it has one). Set with (actor setCycle:EndLoop [caller]).
In file: | motion.sc |
Inherits from: | CycleTo |
Inherited by: | none |
BegLoop
This sub-class of CycleTo decrements the cel number from its current value to 0, then stops and cue:s its caller, if any. Set with (actor setCycle:BegLoop [caller]).
In file: | motion.sc |
Inherits from: | CycleTo |
Inherited by: | none |
- Notes
< Previous: The PicView Class Next: The Motion Classes >