Ego (of Actor)

class Ego

Defined in Ego.sc.

The Ego represents the player’s main character. It extends Actor by handling the following:

  • Sends the player to a new room when they walk off screen.
  • Moves the player to a new destination when the user clicks the walk icon somewhere.
  • Handles getting and losing inventory items.

Subclasses: GameEgo.

class diagram

Properties

Inherited from Actor:

Property Description
x  
y  
z  
heading  
noun  
case  
modNum  
nsTop  
nsLeft  
nsBottom  
nsRight  
sightAngle  
actions  
onMeCheck  
state  
approachX  
approachY  
approachDist  
_approachVerbs  
yStep  
view  
loop  
cel  
priority  
underBits  
signal  
lsTop  
lsLeft  
lsBottom  
lsRight  
brTop  
brLeft  
brBottom  
brRight  
scaleSignal  
scaleX  
scaleY  
maxScale  
cycleSpeed  
script  
cycler  
timer  
detailLevel  
scaler  
illegalBits  
xLast  
yLast  
xStep  
origStep  
moveSpeed  
blocks  
baseSetter  
mover  
looper  
viewer  
avoider  
code  
name  

Defined in Ego:

Property Description
edgeHit  

Methods

init()
doit()
handleEvent(pEvent)

Handles moving the ego around.

facingMe()

Always returns TRUE. You are me!

get(invNumber [...])

Gives the ego an inventory item (or items).

Parameters:invNumber (number) – The numerical identifier of the inventory item.

Example usage:

; Give the ego the crystal and the lizard tail.
( gEgo get: INV_CRYSTAL INV_LIZARDTAIL)
put(invNumber [newOwner])

Removes an inventory item from the ego, and optionally gives it to a new owner.

Parameters:
  • invNumber (number) – The numerical identifier of the inventory item.
  • newOwner (number) – The optional new owner (typically a room number).

Example usage:

; The ego used lizard tail, so remove it from the inventory:
(gEgo put: INV_LIZARDTAIL)
has(invNumber)

Determines if the ego has an inventory item.

Parameters:invNumber (number) – The numerical identifier of the inventory item.

Example usage:

(if (gEgo has: INV_LIZARDTAIL)
        ; Do something...
)