What is the Bounds Class?
The Bounds class in MiniScript is a built-in tool for handling rectangular bounding boxes.it defines an area in 2D space, making it easy to detect overlaps.
Why is it important?
If you're developing a game, you need to know when objects collide, when a player clicks on an item, or when a character enters a certain zone.
Features of the Bounds Class
Positioning & Dimensions
Every Bounds object has an (x, y)
position that represents its center. Instead of using a top-left or bottom-left corner, MiniScript centers everything. This makes rotations and scaling easy
-
Bounds.x
andBounds.
y – Define the center point. -
Bounds.width
andBounds.height
– Set the size.
Rotation Support
Bounds in MiniScript can rotate! Using Bounds.rotation
This is super useful for angled collision detection.
Corner Coordinates
The Bounds.corners
property gives you a list of [x, y]
pairs, making it easy to work with collision systems.
Collision Detection
The Bounds class provides two important methods for collision detection;
Bounds.overlaps(b)
- Checks if two bounding boxes overlap.
Bounds.contains(x, y)
- Checks if a point is inside the bounding box.
Links
Learn
Official Bounds documentation
All Material
Personally Suggested
Miniscript Series
My Social Accounts
Top comments (0)