Defined in Feature.sc.
Feature forms the base class for interactable items in the game. Actor, Prop and View all extend from this class. It can also be used on its own, generally for attaching interactions to static portions of the background.
Feature has support for displaying messages when the player performs actions (verbs) by clicking on it. It will also optionally direct the ego to approach the feature.
; Define a red plant that displays messages associated with the noun N_PLANT ; when the use clicks on the white control color on the pic background. ; The (x, y) coordinates are used to identify the "center of interest" of the feature, ; which determines the direction in which the ego should face when interacting with it. (instance redPlant of Feature (properties x 217 y 121 noun N_PLANT onMeCheck ctlWHITE ) )
There are two main ways to identify the bounds of a feature: control colors, and polygons. Even if onMeCheck has been set in the Feature declaration, this needs to be done with the setOnMeCheck() method.
You can also indicate for which verbs the ego should approach the feature (as opposed to just facing it). This is done with the approachVerbs() method.
(redPlanet approachVerbs: V_DO V_LOOK setOnMeCheck: omcCOLORS ctlWHITE init: )
Defined in Feature:
|x||“center of interest” for the Feature.|
|noun||Message noun associated with the Feature.|
|case||Message case associated with the Feature.|
|onMeCheck||omcDISABLE, omcCOLORS or omcPOLYGON. See setOnMeCheck().|
|approachX||The approach spot x.|
|approachY||The approach spot y.|
|approachDist||The approach distance.|
|_approachVerbs||Bitmask for verbs that cause the ego to approach the Feature.|
Initializes the Feature. This must be done prior to it being active in the scene.
Parameters: initCode (heapPtr) – Optional initialization
Codefor the feature. Generally, this is left unspecified.
This method can be overridden by Feature instances to provide custom logic when the player interacts with the feature. By default, it displays any message resource associated with the given verb for this Feature’s noun.
Parameters: theObj (heapPtr) – Optional object that the Feature might be facing. If not specified, the player’s ego is used.
Returns TRUE if this Feature is facing the specified object (or ego).
- theObj (heapPtr) – The object that might be on the Feature.
- x (number) – The x coordinate.
- y (number) – The y coordinate.
TRUE if the (x, y) or object is on the Feature.
Indicates which verbs should cause the ego to approach the feature.
Parameters: verbs (number) – An optional series of verbs.
(theToy approachVerbs: V_DO V_EAT)
setOnMeCheck(omcCOLORS [colors ...])
Controls how the Feature is identified (colors or polygon), or disables the onMe check.
- polygon (heapPtr) – A polygon defining the boundaries of the Feature
- colors (number) – Control color(s) defining the Feature.
(theTable setOnMeCheck: omcCOLORS ctlWHITE ctlGREY) (theRock setOnMeCheck: omcPOLYGON (CreateNewPolygon @P_TheRock))