Room (of Region)

class Room

Defined in Game.sc.

Room is the class that your room instances should inherit from.

Properties

Inherited from Region:

Property Description
name  
script Room script, generally set with setScript in the init() method.
number  
modNum  
noun Noun associated with the room background.
case Case associated with the room background.
timer  
keep  
initialized  

Defined in Room:

Property Description
picture The number of the pic resource for the room background.
style The dp* animation flags that control room opening animation.
horizon y coordinate of room’s horizon.
controls  
north The room to the north (if appropriate)
east The room to the east (if appropriate)
south The room to the south (if appropriate)
west The room to the west (if appropriate)
curPic  
picAngle How far from vertical is the view? 0-89
vanishingX  
vanishingY  
obstacles  
inset  

Methods

init()

Override this method to provide the needed initialization for your room. Make sure to call (super:init()).

doit()

Override this method to provide custom logic that is executed every game cycle for your room. Make sure you call (super:doit()).

dispose()
handleEvent(pEvent)

Override this method to provide custom event handling logic for your room. Make sure you call (super:handleEvent(pEvent)).

newRoom(newRoomNumber)

This tells the room that we want to switch to a new room. This is the main way to switch rooms.

Example usage:

(gRoom newRoom: 145)
setRegions(scriptNumbers)

Lets you indicate which regions this room is part of.

Parameters:ScriptNumbers (number) – One or more script numbers for scripts that contain a public Rgn instance.

Example usage:

(method (init)
        (self setRegions: SNOW_REGION MOUNTAIN_REGION)
        ; etc, do more room initialization...
        (super init:)
)
drawPic(picNumber [picAnimation])

Draws a pic background.

Parameters:
  • picNumber (number) – The number of the pic resource.
  • picAnimation (number) – An optional dp* enum value (e.g. dpOPEN_INSTANTLY).

See the DrawPic() kernel for more information on animation flags.

overlay(picNumber [picAnimation])

Overlays an additional pic on top of the current background.

Parameters:
  • picNumber (number) – The number of the pic resource.
  • picAnimation (number) – An optional dp* enum value (e.g. dpOPEN_INSTANTLY).
addObstacle(polygon sendParams)

This can be used to add polygon obstacles to the current room.

Example usage:

(gRoom addObstacle: (CreateNewPolygon @P_Flower))
reflectPosn(theActor theEdgeHit)

Assigns the actor a new position based on the edge that it left from in the previous room.

edgeToRoom(theEdgeHit)
Parameters:theEdgeHit (number) – EDGE_TOP, EDGE_LEFT, EDGE_RIGHT or EDGE_BOTTOM.
Returns:The room number associated with that edge.
roomToEdge(roomNumber)
Parameters:roomNumber (number) – A room number.
Returns:The edge associated with that room number (or the room number if no edge associated).
setInset([theInset theCaller theRegister])

Sets an Inset on this room. To clear the inset, pass no parameters.

Parameters:
  • theInset (heapPtr) – The Inset instance.
  • theCaller (heapPtr) – An object that will get cue()’d when the Inset is disposed.

Example usage:

(gRoom setInset: cageCloseUp self)