Barriers in widget

I’m creating a maze game inside of a widget, where you have a player that has to navigate through the maze and get to the end. Problem is the player can go outside the bounds of the maze, is there a way to add triggers and collision barriers so the player is constricted to an area?

I don’t see a reason why you want to do this only in widgets, but you can always restrict the camera, and anything you move across the screen, depending on x/y values. If you have the player pawn/character moving on the screen you could spawn collision volumes or collision boxes, but really this can be done entirely without widgets. If you want a widget overlay, this can be in place without affecting the player movement. Widgets do not interact with the player or any other pawn/actor, they are a 2D interface layer.

Depending on what you are looking for, you could have a grid of cells (A data structure), and restrict the player’s movement to those cells. Each cell would have a state (Blocking / Non blocking), and you could create a reusable collision widget that sets the states of all cells that it encapsulates to blocking in the parent. When the player tries to move, you would check the state of the cell that they are trying to move into, and disallow the movement if it is blocking. You could even go further and add other gameplay based on additional cell states.

Thanks for your response! I attempted to do it outside of a widget, but I need it to be in a widget for a couple reasons

This sounds like it’ll definitely work for what I need, thank you!