Handling backgrounds

Backgrounds are the building block art assets for each room in an adventure game. They give depth and set the mood.

Escoria supports multiple features for backgrounds.

The main node type for backgrounds is ESCBackground. Additionally, certain features of ESCTerrain add more features to the background.

Backgrounds can come in all sizes. They may be the exact size as the screen, or they may be bigger or smaller. Escoria uses its Camera features to handle different-sized backgrounds.

Camera limits define how the camera follows the player and pans over the background. The developer can enable and disable camera limits in the game to temporarily hide or show parts of the scene.

Parallax backgrounds

Parallax layering is a technique used to add depth to a two-dimensional graphic by moving different layers at diffferent speeds as the camera pans over them.

Godot has that functionality built-in with the ParallaxBackground and ParallaxLayer node types.

This tutorial introduces their functionality.

Basically, after adding both a ParralaxBackground and at least one ParallaxLayer node to the scene, the ParallaxLayer’s parameter motion_scale specifies how fast the movement of the additional layer will be moved in contrast to the static background.

Additionally, the layer parameter of the ParallaxBackground should be set to 0 to allow the character to move behind the layer.

Scaling

In addition to the Parallax method, another technique to add depth to a two-dimensional scene is to change the size of the player character as it walks from the front to the back of the scene (or vice versa).

In Escoria, this is achieved by using the different parameters of the ESCTerrain node in the scene: The scales parameter uses a texture. Darker areas of the texture result in a smaller sprite, while lighter areas scale the sprite up. scale_min and scale_max limit the scaling.

Lighting

Another feature to make rooms more lively is to give them dynamic lighting, so that certain parts of the screen tint the character sprite as though it was walking through different light sources in the background.

The parameter lightmap expects a texture that is to be laid over the scene and tints the character according to the position of the character in the scene.

The parameter lightmap_modulate can be used to additionally tint the lightmap texture.