HomeIndex

Room Functions

A room is basically a screen that objects and actors can be placed into. A room also has walkboxes that define the pathing an actor can use when walking around.
The tool Wimpy is used to define the visual characteristic of a room and it's objects
The enterRoom() command changes rooms and there is a global currentRoom variable that always hold the current room.
defineRoom(table)
Defines a room using table as it's code.
The table can not be reused for two different rooms.
When the room is created a _id variable is added to the table that is the room's unique id.
Another variable called _key is also added which represents the name of the room used to load the .wimpy file.
enterRoom(room|object[,door])
Causes the game to enter a new room
If passed an object, the room will be the room the object is defined in. If passed a door then the camera will be at that object.
findRoom(name|id|room)
Returns a room from it's name, id or table.
roomSize(room)
Returns the size of a room based on it's image size.
roomToScreen(point)
Returns the screen coordinates of a point in the current room.
screenToRoom(point)
Returns the room coordinates of a point on the screen.
addTrigger(trigger, func)
Returns the id of the new trigger added to the room.
Triggers need to be reset everytime roon.enter() is called. The id returned is just the object id for the object and doesn't need to be retained unless multiple triggers are being created from one object.
removeTrigger(object|id)
Removed a trigger from the room
enableTrigger(trigger_id, state)
Enable or disables a trigger based on state
findObjectAt(pos)
Returns a touchable object at the room cordinates.
This follows the same touchable/invisible rules that game uses for finding objects.
findActorAt(pos)
Returns a touchable actor at the room cordinates.
This follows the same touchable/invisible rules that game uses for finding actorss.
findActorObjectAt(pos)
Returns a touchable actor or object at the room cordinates.
This follows the same touchable/invisible rules that game uses for finding objects and actors. Actors have a higher priority than objects. findActorObjectAt() will never return the selectedActor.
roomLayer(room, layer, state)
Show or hide a room layer.
walkboxHidden(name, state)
Sets a walkbox hidden state to state
This only works for walkboxes in the current room. The function returns the number of walkboxes effected by the change.
ambientLight([room,]color)
Set the ambient light for a room.
roomLightPosition(id, pos|object)
Set the position of a light for a room.
roomLightEnable(id, state)
Enables or disables a room light.
clampInWalkbox(pos[,pos2])
Finds a point that is clamped in walkboxes.