View (of Feature)

class View

Defined in Actor.sc.

The View class is an essential part of SCI games. It is the base class for Prop, Actor and the like. It extends Feature by providing the ability to be dynamically positioned at different places, and by automatically setting its bounds based on its view, loop and cel. It is often (though not exclusively) used to add static views to the background, via its addToPic method.

Example definition:

(instance ship of View
        (properties
                x 6
                y 92
                noun N_SHIP
                view 113
                loop 2
                cel 1
                signal ignAct   ; Don't interact with Actors
        )
)

Example initialization:

(ship init:)

Subclasses: Prop.

class diagram

Properties

Inherited from Feature:

Property Description
x x position. See posn().
y y position. See posn().
z z position. See posn().
heading The angle direction the View faces.
noun The noun for the View (for messages).
case The optional case for the View (for messages).
modNum Module number (for messages)
nsTop “Now seen” rect. The visual bounds of the View.
nsLeft  
nsBottom  
nsRight  
sightAngle  
actions  
onMeCheck The type of onMe checks that are done.
state  
approachX The approach spot x.
approachY The approach spot y.
approachDist The approach distance.
_approachVerbs Bitmask indicating which verbs cause the ego to approach.
name  

Defined in View:

Property Description
yStep  
view The view number for View.
loop The loop of the View.
cel The cel of the View.
priority The priority of the View.
underBits  
signal  
lsTop The “last seen” rect.
lsLeft  
lsBottom  
lsRight  
brTop The “base rect”.
brLeft  
brBottom  
brRight  
scaleSignal  
scaleX Current x scale.
scaleY Current y scale.
maxScale Max scale.

Methods

init()
dispose()
showSelf()

Prints a description of the View on the screen.

isNotHidden()
onMe(x y)
onMe(obj)

Determines if an object or an (x, y) coordinate lies within the View.

Parameters:obj (heapPtr) – An object with x and y properties.
Returns:TRUE if it’s on the View, otherwise FALSE.
posn(theX theY [theZ])

Sets the position of the View and updates its base rectangle.

stopUpd()
forceUpd()
startUpd()
setPri(thePriority)
Parameters:thePriority (number) – The new priority of the View. If -1 is specified, the View updates its priority based on its y coordinate.
setLoop(theLoop)

Sets the loop of the View.

setCel(theCel)

Sets the cel of the View.

ignoreActors(shouldIgnore)

Tells the View if it should or should not interact with (bump into) other objects.

Parameters:shouldIgnore (boolean) – If TRUE (or not specified), the View should ignore other objects.
hide()

Hides the View.

show()

Shows the View.

delete()
addToPic()

Draws the View permanently on the background.

lastCel()

Returns the last valid cel of the View.

motionCue()
checkDetail()
setScale([theY])

Sets the scale of the View. If no parameters are provided, the view will be scaling, but not have auto-scaling.

Parameters:theY (number) – The y parameter corresponding to 100% size for auto-scaling. Passing 0 will disable scaling.