Regions are game objects that can have an arbitrary shape. They are useful all sorts of common problems, such as creating a clickable area of a background image. Regions are drawn using the region tool in the Tools pane.
Creating a region
To draw a region, click the Region Tool in the tools pane, then click on the stage to start drawing. Each time you click, a new region point will be added to the shape of the region. Double clicking closes the region and ends drawing.
Adding a point to a region
You cn add a point to an existing region by selecting the region tool and double-clicking on one of the region’s edges.
Using regions
Regions don’t do anything on their own, but combined with other components they are very versatile. Here are some of the ways you can use regions:
- Create a clickable area on a background image. Draw a region around the area in question and then add a Clickable component to it with the
Add > Clickable
menu. - Block an area from clicks. Draw a region and add a clickable as above, but do not assign any actions to it. In the Tools pane, select the Layer tab and move the region to the top of the list. When active, the region will block objects under it from receiving a click or drag.
- Create a destination for a dragged object. Create a Draggable object and edit its
Actions when drag ends
action. Add a Check if Objects Overlap action and use it to compare the draggable and the region. If the dragged object was dropped on top of the region, theAction if overlapping
action will fire. - Constrain an object to an area. Draw a region around an area that contains a draggable object. In the Draggable component for that object, specify the region object in the
Keep within region
field. This will prevent the object from being dragged outside of the region.