Ego (of Actor)¶
-
class
Ego¶ Defined in Ego.sc.
The Ego represents the player’s main character. It extends
Actorby 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: SQEgo.
Properties¶
Inherited from Actor:
| Property | Description |
|---|---|
| x | |
| y | |
| z | |
| heading | |
| noun | |
| 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 |
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. (send 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: (send 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 (send gEgo:has(INV_LIZARDTAIL)) // Do something... )