This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zone [2025/03/30 16:45] – justin | zone [2025/04/03 13:57] (current) – justin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Zone====== | + | ======Zones====== |
---- | ---- | ||
- | A zone is a box-shaped area/region within a [[map]], defined by a position (using the [[tile]] [[coordinate]] system) and a size (measured in [[voxel|voxels]]). Zones can be either passable or impassable. Passable zones allow [[character|characters]] and [[object|objects]] to pass through them freely, with an option to trigger a [[script]] whenever a [[character]] or [[object]] enters or exits the zone. Impassable zones, only applicable to free movement, act as obstacles and prevent [[character|characters]] and [[object|objects]] from passing through them or entering that area, with an option to trigger a [[script]] whenever one collides with the zone. | + | A **zone** is a box-shaped area/region within a [[map]], defined by a position (using the [[tile]] [[coordinate]] system) and a size (measured in [[voxel|voxels]]). Zones can be either passable or impassable. Passable zones allow [[character|characters]] and [[object|objects]] to pass through them freely, with an option to trigger a [[script]] whenever a [[character]] or [[object]] enters or exits the zone. Impassable zones, only applicable to free movement, act as obstacles and prevent [[character|characters]] and [[object|objects]] from passing through them or entering that area, with an option to trigger a [[script]] whenever one collides with the zone. |
+ | |||
+ | {{: | ||
Zones are created and modified from the [[Map Properties]] tab in the [[Map Editor]]. When assigning [[script|scripts]] to zones, the built-in **// | Zones are created and modified from the [[Map Properties]] tab in the [[Map Editor]]. When assigning [[script|scripts]] to zones, the built-in **// | ||
- | ===Example Usages=== | + | ====Example Usages==== |
* Blocking off areas to ensure they' | * Blocking off areas to ensure they' | ||
- | * Resetting the player when they fall off the edge of a map (see video below) | + | * Resetting the player when they fall off the edge of a [[map]] (see video below) |
- | * Triggering a cutscene when the player enters a certain area of a map | + | * Triggering a cutscene when the player enters a certain area of a [[map]] |
- | * Applying a status effect to the player when they' | + | * Applying a [[status effect]] to the player when they' |
* And so much more! | * And so much more! | ||
- | | + | |
+ | The **First-Person Magic Shooter** project template includes some uses of zones. The passable zone inside the room behind the locked door (the green area in the image below) triggers the end of the game when the player enters the zone. The impassable zone above that room's walls (the red area in the image below) prevents the player from jumping over the walls to bypass the locked door. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The colored boxes for zones in the [[Map Editor]] can be hidden using the **Display Zones** button on the [[Map Editor]] toolbar. They can also be hidden along with other visual indicators by holding the Backtick (`) key, or Shift + Backtick (`) key to toggle all of them off. | ||
+ | |||
+ | ====Scripting==== | ||
+ | From a scripting perspective, | ||
+ | * **[[Add Zone]]**: Adds a new zone to the current [[map]], with parameters for zone name, passability, | ||
+ | * **[[Disable Zone]]**: Disables a zone in the current [[map]], e.g. **disable_zone(" | ||
+ | * **[[Enable Zone]]**: Enables a zone that was previously disabled via the [[Disable Zone]] function, e.g. **enable_zone(" | ||
+ | * **[[Remove Zone]]**: Removes a zone from the current [[map]], e.g. **remove_zone(" | ||
+ | * **[[Set Zone Script]]**: Modifies a zone's [[script]], with trigger options of CHARACTER_ENTER and CHARACTER_EXIT for passable zones and CHARACTER_COLLIDE for impassable zones. For example, **set_zone_script(" | ||
+ | |||
+ | **Bauxite Examples: | ||
+ | <code bauxite> | ||
+ | add_zone(" | ||
+ | set_zone_script(" | ||
+ | set_zone_script(" | ||
+ | </ | ||
~~NOTOC~~ | ~~NOTOC~~ |