.. Rm

.. default - domain::js

.. include:: /includes/standard.rst

====================
Rm (of :class:`Rgn`)
====================

.. class:: Rm

	Defined in Game.sc.

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


Properties
==========

Inherited from :class:`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
==========

.. function:: init()
	:noindex:

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


.. function:: doit()
	:noindex:

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


.. function:: dispose()
	:noindex:



.. function:: handleEvent(pEvent)
	:noindex:

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


.. function:: newRoom(newRoomNumber)
	:noindex:

	
	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))
	


.. function:: setRegions(scriptNumbers)
	:noindex:

	
	Lets you indicate which regions this room is part of.
	
	:param number ScriptNumbers: One or more script numbers for scripts that contain a public :class:`Rgn` instance.
	
	Example usage::
	
		(method (init)
			(self:setRegions(SNOW_REGION MOUNTAIN_REGION))
			// etc, do more room initialization...
			(super:init())
		)
	



.. function:: drawPic(picNumber [picAnimation])
	:noindex:

	Draws a pic background.

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




.. function:: overlay(picNumber [picAnimation])
	:noindex:

	Overlays an additional pic on top of the current background.

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



.. function:: addObstacle(polygon sendParams)
	:noindex:

	
	This can be used to add polygon obstacles to the current room.
	
	Example usage::
	
		(send gRoom:addObstacle(CreateNewPolygon(@P_Flower)))
	


.. function:: reflectPosn(theActor theEdgeHit)
	:noindex:

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


.. function:: edgeToRoom(theEdgeHit)
	:noindex:

	
	:param number theEdgeHit: EDGE_TOP, EDGE_LEFT, EDGE_RIGHT or EDGE_BOTTOM.
	:returns: The room number associated with that edge.
	


.. function:: roomToEdge(roomNumber)
	:noindex:

	
	:param number roomNumber: A room number.
	:returns: The edge associated with that room number (or the room number if no edge associated).
	



.. function:: setInset([theInset theCaller theRegister])
	:noindex:

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

	:param heapPtr theInset: The Inset instance.
	:param heapPtr theCaller: An object that will get cue()'d when the Inset is disposed.

	Example usage::

		(send gRoom:setInset(cageCloseUp self))



