Skip to content

SCUMM 8 API: Rooms

Paul Nicholas edited this page Sep 20, 2021 · 5 revisions

Each screen that the user sees is a Room in SCUMM-8. This can be a room in the traditional sense, such as a hallway or bedroom - or it can be an exterior scene. Rooms can even be used to simulate "title" screens and special effects. A Room is basically just a backdrop image that can contain other stuff.

Room Definitions

Properties

The following properties apply to Room definitions.

  • map

    • The x1,y1 (top-left cell pos) and x2,y2 (bottom-right cell pos) of the map that should be used as the room.
      For example: map = {80,24,103,31}
  • trans_col

    • The color to draw as transparent (defaults to 0 = black)
  • col_replace

    • Allows you to specify an alternative color to one originally in room/object/actor sprites. Useful for reusing existing content.
    • For example: col_replace = {5,2}
  • lighting

    • Specifies the lighting level to use for a given room/object/actor, from 1=Normal to 0=black (default = 1).
    • For example: lighting = 0.75
  • autodepth_pos

    • Specifies the Y-positions use for simulated 3D depth, to make it seem Actors are walking closer to/further from the screen. Stored as a pair of numbers, which represent the top-most and bottom-most Y-positions on screen, when auto-scaling Actors in a room based on their position (default = {9,50}).
    • For example: autodepth_pos = {9,50} (Actor will be their smallest size at <= 9px from top of viewscreen, and at their standard size at >= 50px)
  • autodepth_scale

    • Specifies the scale to use for simulated 3D depth, to make it seem Actors are walking closer to/further from the screen. Stored as a pair of numbers, which represent the smallest and largest scale to use when auto-scaling Actors in a room, based on their position. Range is from 0=Tiny/Very far to 1=Normal size/Close (default = {0.25,1}).
    • For example: autodepth_scale = {0.25,1} (Actor will be 1/4 original size at the farthest "distance", and orig size at closest point)

Objects (list)

Specifies the list of objects (variables) that should exist in this room. If objects are not added to a Rooms objects list, they will not be drawn.

For example:

objects = {
  obj_library_door_hall,
  obj_lightswitch,
  obj_fire
},

Enter (func)

If specified, the code within the enter function will be executed every time the room is "entered". Therefore, if you only want the code run once, you'll need to set a flag and check for it.

For example:

enter = function(me)
  -- animate fireplace
  start_script(me.scripts.anim_fire, true) -- bg script
end,

Exit (func)

If specified, the code within the exit function will be executed every time the room is "exited". Therefore, if you only want the code run once, you'll need to set a flag and check for it.

For example:

exit = function(me)
  -- pause fireplace while not in room (to save cpu)
  stop_script(me.scripts.anim_fire)
end,

Room Design

"Walkable" tiles

  • Rooms are built using portions of PICO-8 map data, made up of sprite tiles.
  • For a sprite tile to be deemed "walkable", you must set the Flag 0 (see below).
  • Otherwise the selected player will not be able to navigate a path to the tile when used in a room's map.

Clone this wiki locally