Levelshot - Level Screenshots

by jhlothamer

0

Godot Levelshot Add-On

This add-on is for creating images of a 2D level in Godot 4. This is useful for documentation or creating level thumbnails for your game.

Install

To install this add-on, look for it in the Godot asset library. Or you can download this repository and copy the addons/levelshot folder to your project.

Setup

Levelshot comes with the following project setting.

  • Image Save Folder - Levelshot saves images created from levels in this folder. It's default path is user://levelshots

To easily open the user:// folder for your project, simply select Project -> Open User Data Folder from the Godot Editor menu.

How To Use

This add-on consists of a main screen UI titled Levelshot. In this UI you can set default settings to use for all your levels or have individual settings.

Main Screen UI

Adding Levels

To add one ore more levels to the Levels list, simply click on the Add Scene button () at the top of the list.

Capturing All Levels

By clicking the Capture All Checked button below the Levels list, levelshots of each checked level will be created. To exclude a level from this process, simply uncheck it in the list.

Capturing A Single Level

To capture levelshots for a single level, select that level in the list and click the Capture Level button at the bottom of the right panel. Note: you may have to scroll down to see it.

Opening a Level Scene

Double clicking a level in the Levels list will cause it to be opened in the Godot editor.

Level Settings

Each level can have tailored settings or be set to mirror the default setting.

Mirror Default Level Settings

If checked, the default level settings will be used for the level. Note that any edits done for the level will be kept so you can simply uncheck this option to use the level specific settings you had before.

Image Size

The resulting image size is determined by these options.

  • Scale - the full image is scaled down by this amount.
  • Max Size - the full image is scaled to fit within this size, keeping the level boundary aspect ratio.
  • Use Scale but limit to Max Size - Image size is calculated for by Scale, but will be scaled down further if it is bigger than Max Size

Level Boundary

Use these options to set what is considered the boundary or boundaries of the level.

  • Calculate - looks for visible nodes of the following type and sets the level boundary based on that: Control, Polygon2D, Sprite2D, TileMap, TileMapLayer, MultiMeshInstance2D.
  • Use LevelshotBoundary - A custom node comes with Levelshot called LevelshotBoundary. Its really just a fancy ReferenceRect. Use this to manually set the boundary or even have multiple boundaries for a level.
    • Note: if no LevelshotBoundary nodes are in the level, the Calculate option will be used to ensure a levelshot is always created.
  • Use Both - use both boundaries and calculate.

Excluded Node Groups

Any node with one of the groups listed in this option will be set to invisible.

Include Canvas Layers

Canvas layers are excluded by default as they are often used as HUDs, but with this option you can turn off this exclusion.

Pause Before Capture

If this value is greater than zero, the capture process will pause this long before pausing the game. This is useful if some time is required for things to settle in the game level - like characters falling to the ground.

Capture Plugin Script

There may be other tasks needed to prepare your game level for a levelshot. This could be anything but an example might be to remove characters from the level so that you only capture the level itself.

This script must derive the LevelshotCapturePlugin custom class and override the prepare() function as shown below.

extends LevelshotCapturePlugin


func prepare(level:Node) -> void:
	print("Capture plugin called!")

The level parameter is an instance of the game level being captured. It has been added to the tree before this function is called.

NOTE: The plugin script is not a Node. Use the level Node for any node related operations.

Support This and Other Free Tools

If you would like to support my development work to maintain this and other such projects you can do so at https://www.buymeacoffee.com/jlothamer.

Version

4.3.0

Engine

4.3

Category

2D Tools

Download

Version4.3.0
Download Now

Support

If you need help or have questions about this plugin, please contact the author.

Contact Author