Skip to content

Preview Manager

Zay Arriaga edited this page Jun 10, 2026 · 9 revisions

System Summary

Handles the "preview tile map", which is a transparent tile map in front of the main one that displays a preview of the object currently being placed.


Connected Systems

Connecting Systems:

Bugs

  • None

Feature List / Breakdown of Features

List of features and descriptions within system.

Standard Features:

  • Displays a single transparent tile in front of the mouse, corresponding with the currently selected object being placed.
  • Preview will be red if the object is not placeable (either being out of bounds or a tile being placed on an entity and vice versa.)
  • When moving entities with the cursor, preview is replaced with a fully opaque version of the entity being moved.

Box Brush Mode

  • Preview tiles will cover the entire box area when using the box brush tool.
  • Preview area will freeze after releasing the mouse, and then clear upon the placement/deletion of the tiles.
  • Preview appears red when deleting in a box area.

Important Variables

Name the most important variables, their type, and what their purpose is

  • editorManager: Node2D = A reference to the editor manager.
  • toolManager: Node2D = A reference to the tool manager.
  • tileSet: TileMapLayer = A reference to the main tile set.
  • brushObject: int = The current object selected to be used by tools.

Important Functions

Name of the most important functions, their parameters, and what they do.

  • func update_preview_object(mousePosition: Vector2, prevPosition: Vector2, isRed: bool) -> void: Updates the preview object based on the mousePosition. Will also clear the previous preview based on prevPosition, and sets the preview to be red and invalid if isRed is true.

  • func update_box_preview(firstCorner: Vector2, secondCorner: Vector2) -> void: Updates the Box Brush preview object based on the firstCorner and secondCorner, which will fill in the area selected by the user with the selected brushObject.


Future Work / Risks

List and description of upcoming work/risks.

Future Work:

  1. Implement tiles placed in editor carrying over to play mode
  2. Implement saving and loading of maps

Risks:

  • None.

Miscellaneous Notes

A place for miscellaneous notes pertaining to this system.

  • None.

Clone this wiki locally