Skip to content

Room

namespace Griff.Scenes;
public sealed class Room : Component

One room of a level, for a camera that moves room by room (a Metroidvania, a dungeon, Celeste’s screens). While the camera’s Follow target is inside a room, the camera stays inside it, in place of its StayInside; when the target crosses into another room, the camera slides over to it in Transition seconds, with the game held still meanwhile if Freeze is ticked. Rooms can change the music and how dark it is, and say they’ve been entered with a message.

A room is a box of Size centered on its entity. Make rooms at least as big as the camera’s view; where they overlap, the one listed first wins. Out of every room (a gap between them), the camera keeps to the last one.

This is a component: its saved properties are on its component page.

public Color Ambient { get; set; }

The camera’s Ambient light in here: a dark color for a cave in a sunny level. Transparent (the default) gives the camera back its own.

public Box Area { get; }

The world-space box the room covers.

public bool Freeze { get; set; }

Holds the game still while the camera slides over, so nothing moves under the player’s nose.

public bool IsCurrent { get; }

True while it’s the room the camera is in.

public string? Message { get; set; }

A message sent with Game.Send when the room is entered, with the room’s entity as its data.

public string? Music { get; set; }

Music that starts when the room is entered, e.g. “Music/cave.mp3”. Empty leaves the music alone.

public Vector2 Size { get; set; }

The room’s width and height in world units. 18 by 10 is one screen with the default camera.

public float Transition { get; set; }

Seconds the camera takes to slide over when the target enters. 0 cuts straight there.

public event Action<Entity>? Entered

Raised when the camera’s target enters the room (including the room it starts in), with the target.