Rm (of Rgn)

class Rm

Defined in Game.sc.

Rm (or “room”) is the class that your room instances should inherit from.

Properties

Inherited from Rgn:

Property Description
script  
number  
modNum  
noun  
timer  
keep  
initialized  

Defined in Rm:

Property Description
picture  
style  
horizon  
controls  
north  
east  
south  
west  
curPic  
picAngle  
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:

(send 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).
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:

(send 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:

(send gRoom:setInset(cageCloseUp self))