+ -

06 - Range Checking

Range Checking lets a character detect if a target exists within a certain distance. Unlike Collision Checking (which requires physical hitbox contact), Range Checking is about awareness: an enemy spotting the player, a turret acquiring a target, an NPC reacting when you get close.

Use case: An enemy starts chasing the player when they come within 5 tiles. A guard only sees the player inside a vision cone. A sensor detects nearby bombs.


To use Range Checking, simply call conditional branch:
checkRange(source, range, target, eyes, blockRegion, exception)

source - Who is looking. 
range - Detection radius in tiles (circular).
target - What to look for.
eyes - (Optional) Field of view in degrees.
blockRegion - (Optional) Region ID that blocks line of sight
exception - (Optional) Events with this notetag will be excluded from detection

Examples


In the enemy's parallel page, call conditional branch:

checkRange(this, 5, player)
This will return true if player is within 5 tiles from the enemy itself. (right side enemy)

checkRange(this, 7, player, 90)
The enemy only detects the player within 7 tiles AND inside a 90° cone facing the enemy's current direction. (left side enemy)

checkRange(this, 7, player, 90, 10)

Now the player can hide behind anything painted with region 10, even inside the cone. It's like a wall feature.

English
Japanese